Files
cv-site/static/css/04-interactive/_scroll-behavior.css
T
juanatsap 2eafb78954 fix: Mobile view improvements - accordion styling and modal centering
Fixed two critical mobile view issues:

1. Extended CV Sidebar Accordion:
   - Updated sidebar.html to use native <details> element (was div with onclick)
   - Styled accordion header to match CV title badges dark theme (#303030)
   - Applied consistent styling: dark gray background, light text, uppercase, no spacing
   - Result: Sidebars now collapse/expand properly with native HTML functionality

2. PDF Download Modal Centering:
   - Added JavaScript-based centering for mobile viewports (≤768px)
   - Uses inline styles with !important flag to override browser defaults
   - Updated download button to call openPdfModal() function
   - Result: Modal is perfectly centered on mobile (0px offset)

Technical notes:
   - Modal centering required setProperty() with 'important' flag
   - Accordion matches cv-title-badges-header style exactly
   - All tests passing: accordion toggle, modal centering

Files modified:
   - templates/partials/cv/sidebar.html
   - static/css/05-responsive/_breakpoints.css
   - static/js/main.js
   - templates/partials/widgets/download-button.html

Tests added:
   - tests/mjs/43-mobile-accordion-and-modal-test.mjs
   - tests/mjs/46-visual-accordion-style-test.mjs
2025-11-22 16:23:05 +00:00

327 lines
9.6 KiB
CSS

/* ========================================
Scroll Direction - Hide/Show Header
======================================== */
/* Add smooth transition to header elements */
.action-bar,
.navigation-menu {
transition: transform 0.3s ease-in-out;
}
/* Hide header when scrolling down */
.action-bar.header-hidden {
transform: translateY(-100%);
}
.navigation-menu.header-hidden {
transform: translateY(-100%);
}
/* ========================================
Back to Top Button
======================================== */
.back-to-top {
position: fixed;
bottom: 2rem;
right: 2rem;
width: 50px;
height: 50px;
background: var(--black-bar);
color: white;
border: none;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
z-index: 99;
transition: all 0.3s ease;
opacity: 0.2;
}
.back-to-top:hover {
opacity: 1;
transform: translateY(-3px);
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
background: #27ae60;
}
.back-to-top.at-bottom {
opacity: 1;
background: #27ae60;
}
.back-to-top:active {
transform: translateY(-1px);
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}
/* Mobile adjustments */
@media (max-width: 768px) {
.back-to-top {
bottom: 1.5rem;
right: 1.5rem;
width: 45px;
height: 45px;
}
}
/* ========================================
Info Button (Bottom Left)
======================================== */
.info-button {
position: fixed;
bottom: 2rem;
left: 2rem;
width: 50px;
height: 50px;
background: var(--black-bar);
color: white;
border: none;
border-radius: 50%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
z-index: 99;
transition: all 0.3s ease;
opacity: 0.6; /* Increased from 0.2 for better discoverability */
}
.info-button:hover {
opacity: 1;
transform: translateY(-3px);
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
background: #27ae60;
}
.info-button.at-bottom {
opacity: 1;
background: #27ae60;
}
.info-button:active {
transform: translateY(-1px);
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}
/* Mobile adjustments - Flexbox button layout at bottom center */
@media (max-width: 900px) {
/* Hide zoom control on mobile (keyboard shortcuts now visible) */
.zoom-toggle-btn,
.zoom-control {
display: none !important;
}
/* Reset fixed positioning for FLEXBOX buttons on mobile (exclude back-to-top) */
.download-btn,
.print-friendly-btn,
.shortcuts-btn,
.info-button {
position: fixed !important;
bottom: 1.5rem !important;
left: auto !important;
right: auto !important;
width: 50px !important;
height: 50px !important;
/* Removed opacity: 1 !important to allow .footer-hovered to work */
transform: none !important;
}
/* Mobile: Show colors at 50% transparency by default */
.download-btn {
background: rgba(205, 96, 96, 0.5) !important; /* PDF red at 50% */
}
.print-friendly-btn {
background: rgba(255, 255, 255, 0.5) !important; /* White at 50% */
}
.print-friendly-btn iconify-icon {
color: #27ae60 !important; /* Green icon */
}
.shortcuts-btn {
background: rgba(243, 156, 18, 0.5) !important; /* Orange at 50% */
}
.info-button {
background: rgba(39, 174, 96, 0.5) !important; /* Green at 50% */
}
.back-to-top {
background: rgba(39, 174, 96, 0.5) !important; /* Green at 50% */
opacity: 0.5; /* Semi-transparent by default, full opacity when at-bottom */
}
/* Flexbox container behavior - buttons arrange themselves */
/* Buttons will be positioned using JavaScript or individual positioning */
/* For now, use fixed spacing from center */
/* 6 buttons: Download, Print, Shortcuts, Theme, Info, Back-to-top */
/* Spacing: 10px gap between buttons, centered horizontally */
/* Total width: 6 * 50px + 5 * 10px = 350px */
/* Start position: 50% - 175px */
.download-btn {
left: calc(50% - 175px) !important; /* First button */
}
.print-friendly-btn {
left: calc(50% - 115px) !important; /* Second button */
}
.shortcuts-btn {
left: calc(50% - 55px) !important; /* Third button */
}
/* Theme switcher button - fourth position (defined in color-theme.css) */
/* left: calc(50% + 5px) !important; */
.info-button {
left: calc(50% + 65px) !important; /* Fifth button */
}
/* Back-to-top button - now part of the button row (sixth button) */
.back-to-top {
position: fixed !important;
bottom: 1.5rem !important;
left: calc(50% + 125px) !important; /* Sixth button (last) */
right: auto !important; /* Override previous right positioning */
width: 50px !important;
height: 50px !important;
/* Removed fixed opacity - will be controlled by .at-bottom class */
display: flex !important; /* Ensure it's always displayed */
}
/* Always show back-to-top on mobile (don't wait for scroll) */
.back-to-top:hover {
opacity: 1 !important;
}
/* Hover effects - Full color opacity on hover */
.download-btn:hover,
.download-btn.pdf-hover-sync {
background: rgba(205, 96, 96, 1) !important; /* Full red opacity */
transform: translateY(-3px) !important;
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4) !important;
}
.print-friendly-btn:hover,
.print-friendly-btn.print-hover-sync {
background: rgba(255, 255, 255, 1) !important; /* Full white opacity */
transform: translateY(-3px) !important;
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4) !important;
}
.shortcuts-btn:hover {
background: rgba(243, 156, 18, 1) !important; /* Full orange opacity */
transform: translateY(-3px) !important;
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4) !important;
}
.info-button:hover {
background: rgba(39, 174, 96, 1) !important; /* Full green opacity */
transform: translateY(-3px) !important;
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4) !important;
}
.back-to-top:hover {
background: rgba(39, 174, 96, 1) !important; /* Full green opacity */
transform: translateY(-3px) !important;
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4) !important;
}
/* Keep at-bottom state - full opacity colors for each button */
.download-btn.at-bottom {
background: rgba(205, 96, 96, 1) !important; /* Full red opacity */
opacity: 1 !important;
transform: none !important;
}
.print-friendly-btn.at-bottom {
background: rgba(255, 255, 255, 1) !important; /* Full white opacity */
opacity: 1 !important;
transform: none !important;
}
.shortcuts-btn.at-bottom {
background: rgba(243, 156, 18, 1) !important; /* Full orange opacity */
opacity: 1 !important;
transform: none !important;
}
.info-button.at-bottom {
background: rgba(39, 174, 96, 1) !important; /* Full green opacity */
opacity: 1 !important;
transform: none !important;
}
.back-to-top.at-bottom {
background: rgba(39, 174, 96, 1) !important; /* Full green opacity - NO transparency */
opacity: 1 !important;
transform: none !important;
}
/* Make all buttons semi-transparent when footer is hovered (applied via JS) */
.download-btn.footer-hovered,
.print-friendly-btn.footer-hovered,
.shortcuts-btn.footer-hovered,
.info-button.footer-hovered,
.back-to-top.footer-hovered,
.color-theme-switcher.footer-hovered {
opacity: 0.2 !important; /* Make buttons very transparent to see footer */
pointer-events: none !important; /* Prevent interaction when footer is hovered */
}
}
/* Very narrow mobile - Stack buttons vertically or adjust spacing if needed */
@media (max-width: 483px) {
/* For very narrow screens, you may need to adjust button spacing or size */
/* For now, keep the same horizontal layout but buttons might overflow slightly */
/* Users can scroll horizontally if needed, or we can reduce button sizes */
}
/* ========================================
Mobile: Keep action bar visible (prevent hiding on scroll)
======================================== */
@media (max-width: 900px) {
/* Prevent action bar from hiding on scroll on mobile */
.action-bar.header-hidden {
transform: translateY(0) !important; /* Override hide behavior */
}
.navigation-menu.header-hidden {
transform: translateY(0) !important; /* Override hide behavior */
}
/* Add bottom padding to footer so text isn't hidden behind button bar */
footer.no-print {
padding-bottom: 120px !important; /* More clearance for 6 buttons + spacing */
transition: all 0.3s ease;
z-index: 1 !important; /* Keep footer behind buttons (buttons have z-index: 99) */
position: relative;
}
/* Footer hover effect - enlarge text when touched (for button transparency) */
footer.no-print.footer-hovered {
/* Only used for button transparency interaction */
}
/* Footer text automatically enlarges when at page bottom */
footer.no-print.at-bottom {
padding-bottom: 130px !important; /* Extra space when enlarged */
}
footer.no-print.at-bottom p,
footer.no-print.at-bottom a {
font-size: 1.2em !important;
font-weight: 500 !important;
transition: all 0.3s ease;
}
}