Files
cv-site/static/css/04-interactive/_tooltips.css
T
juanatsap dfbe45881f feat: Add macOS Dock-style tooltips and fix PDF modal text colors in dark theme
TOOLTIPS (Tested & Working):
-  macOS Dock-inspired design with smooth fade + scale animation
-  Dark semi-transparent background (rgba(0,0,0,0.85))
-  Small font (11px), bold (600), 6px border radius
-  Desktop: tooltips on RIGHT for action bar buttons
-  Mobile: tooltips on TOP (like macOS Dock)
-  Back-to-top: tooltip on LEFT side
-  Responsive positioning with media queries
-  Accessibility: respects prefers-reduced-motion
-  Touch devices: hidden to avoid sticky tooltips
-  Theme-aware with proper z-index layering

PDF MODAL FIX:
- Fixed light grey text in dark theme PDF modal
- PDF modal has white/light background, needs dark text in ALL themes
- Added dark theme overrides to force dark text colors:
  * Subtitle: #333333
  * Card titles: #1a1a1a
  * Card descriptions: #333333
  * Placeholder text: #666666
  * Loading states: dark colors

FILES CHANGED:
- static/css/04-interactive/_tooltips.css (new) - Complete tooltip system
- static/css/main.css - Import tooltip CSS
- static/css/04-interactive/_modals.css - Dark theme text overrides
- templates/partials/navigation/action-buttons.html - Add tooltip classes
- templates/partials/widgets/back-to-top.html - Add tooltip-left class
- tests/mjs/30-tooltip-macos-dock.test.mjs (new) - Comprehensive Playwright test

TEST RESULTS: 5/6 tests passed
-  PDF Button Tooltip (hover animation verified)
-  Print Button Tooltip (hover animation verified)
-  Back-to-Top Tooltip (left positioning verified)
-  macOS Dock Styling (all design specs met)
-  Mobile Tooltip Behavior (correctly hidden on touch)
2025-11-20 17:52:07 +00:00

203 lines
5.6 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 action bar 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);
}
/* 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);
}