Geizkragen/assets/css/compcard.css

658 lines
17 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file compcard.css
* @brief Styles for Product Cards and Wishlist Cards.
* @details This file contains all CSS rules for displaying animated glass-style
* product cards, grid layouts, horizontal scroll sections, and the wishlist vertical layout.
* It also includes responsive design media queries for tablets and mobile devices.
*/
/**
* ==========================================================
* @section PRODUCT CARDS & SCROLL Animated Glass Cards
* ==========================================================
*/
/**
* @brief Product Grid Container
* @details Creates a CSS grid with autofit columns of 260px each.
* Defines the spacing (gap) and padding around the grid.
*/
.product-grid {
display: grid;
grid-template-columns: repeat(auto-fit, 260px);
gap: 1.5rem;
padding: 2rem;
justify-content: start;
}
/**
* @brief Base Product Card Styles
* @details Sets up the generic layout, colors, shadow, and transitions for a product card.
* The card is designed with a dark background (#2d3b50) and an outline/border,
* utilizing a flexbox column layout. A fade-in animation (fadeInUp) is applied.
*/
.product-card {
background: #2d3b50;
border: 1px solid var(--border-subtle);
border-radius: var(--radius-lg);
overflow: hidden;
box-shadow: var(--shadow-sm);
transition: all var(--transition-smooth);
display: flex;
flex-direction: column;
min-height: 270px;
width: 260px;
text-decoration: none;
color: inherit;
position: relative;
animation: fadeInUp 0.5s ease both;
}
/**
* @brief Gradient border glow effect on hover
* @details Uses a pseudo-element (::before) to create a glowing border using a linear gradient.
* It features a mask to only reveal the border area. Hidden by default (opacity: 0) and shown on hover.
*/
.product-card::before {
content: "";
position: absolute;
inset: -1px;
border-radius: var(--radius-lg);
padding: 1px;
background: linear-gradient(
135deg,
rgba(37, 99, 235, 0.3),
rgba(74, 222, 128, 0.2),
rgba(37, 99, 235, 0.1)
);
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
opacity: 0;
transition: opacity var(--transition-smooth);
z-index: 1;
pointer-events: none;
}
/**
* @brief Inner glow effect on hover
* @details Uses a pseudo-element (::after) to add a subtle gradient at the top of the card.
* It is hidden by default and becomes visible when the card is hovered over.
*/
.product-card::after {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
height: 120px;
background: linear-gradient(180deg, rgba(37, 99, 235, 0.04), transparent);
opacity: 0;
transition: opacity var(--transition-smooth);
pointer-events: none;
z-index: 1;
}
.product-card:hover {
transform: translateY(2px);
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
border-color: transparent;
}
.product-card:hover::before {
opacity: 1;
}
.product-card:hover::after {
opacity: 1;
}
.product-card:focus-visible {
outline: 2px solid #0071e3;
outline-offset: 3px;
}
/**
* @brief Staggered entrance animation delays
* @details Applies incremental animation delays to cards within a horizontal scroll container
* to create a cascading fade-in effect.
*/
/* Stagger cards in scroll */
.product-scroll .product-card:nth-child(1) { animation-delay: 0.05s; }
.product-scroll .product-card:nth-child(2) { animation-delay: 0.1s; }
.product-scroll .product-card:nth-child(3) { animation-delay: 0.15s; }
.product-scroll .product-card:nth-child(4) { animation-delay: 0.2s; }
.product-scroll .product-card:nth-child(5) { animation-delay: 0.25s; }
.product-scroll .product-card:nth-child(6) { animation-delay: 0.3s; }
.product-scroll .product-card:nth-child(7) { animation-delay: 0.35s; }
.product-scroll .product-card:nth-child(8) { animation-delay: 0.4s; }
/**
* @brief Card Image Styling
* @details Defines the size, padding, and positioning of the product image inside the card.
* Uses a white background and adds a bottom border.
*/
.product-card img {
width: 100%;
height: 175px;
object-fit: contain;
object-position: center;
display: block;
flex: 0 0 auto;
background: #ffffff;
padding: 16px;
border-bottom: 1px solid var(--border-subtle);
transition: transform var(--transition-smooth);
position: relative;
z-index: 2;
}
.product-card:hover img {
transform: scale(1.05);
}
/**
* @brief Card Content Container
* @details The wrapper for textual content (title, description, price) inside the card.
* Uses flexbox to space and align the text vertically.
*/
.product-card__content {
padding: 1rem 1.25rem 1.15rem;
flex: 1 1 auto;
display: flex;
flex-direction: column;
min-height: 0;
gap: 0.35rem;
position: relative;
z-index: 2;
}
/**
* @brief Card Title Styling
* @details Styles the <h3> heading, limits it to 2 lines using webkit-line-clamp,
* and sets up a transition for color changes on hover.
*/
.product-card__content h3 {
font-size: 0.92rem;
font-weight: 600;
color: #ffffff;
margin-bottom: 0;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
line-height: 1.4;
transition: color var(--transition-normal);
}
/**
* @brief Card Title Hover State
* @details Changes the color of the <h3> heading when the parent card is hovered.
*/
.product-card:hover .product-card__content h3 {
color: var(--text-invert);
}
/**
* @brief Card Description Styling
* @details Styles the <p> paragraph tag. Limits text to 4 lines with ellipsis
* and handles word-breaking to prevent overflow.
*/
.product-card__content p {
font-size: 0.8rem;
color: #ffffff;
margin-bottom: 0;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical;
word-break: break-word;
line-height: 1.5;
}
/**
* @brief Card Price Styling
* @details Formats the price element, making it bold, blue, and pushed to the bottom of the card.
*/
.product-card__content .price {
font-size: 1.05rem;
font-weight: 700;
color: #0071e3;
margin-top: auto;
padding-top: 0.5rem;
}
/**
* @brief Product Section Wrapper
* @details Adds padding and an entrance animation for sections containing product lists/scrolls.
*/
.product-section {
padding: 2rem 0 0.5rem;
animation: fadeInUp 0.5s ease both;
}
/**
* @brief Product Section Title
* @details Styles the <h2> heading of the section, relative positioning is used for decorators.
*/
.product-section h2 {
margin-left: 2rem;
margin-bottom: 1.25rem;
font-size: 1.3rem;
font-weight: 700;
color: #d8d8ee;
position: relative;
padding-left: 1rem;
display: inline-block;
}
/**
* @brief Animated Accent Line for Section Title
* @details Creates a vertical gradient line next to the <h2> tag that GROWS into place
* using a CSS keyframe animation.
*/
/* Animated accent line */
.product-section h2::before {
content: "";
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 3px;
height: 0;
background: linear-gradient(180deg, var(--color-primary), var(--color-accent));
border-radius: var(--radius-full);
animation: lineGrow 0.6s ease 0.3s forwards;
}
/**
* @brief Line Grow Keyframes
* @details Animation definition for the accent line, expanding its height to 80%.
*/
@keyframes lineGrow {
to { height: 80%; }
}
/**
* @brief Subtle Glow for Section Title
* @details Adds a blurred, colored circle behind the <h2> for a decorative lighting effect.
*/
/* Subtle glow behind section title */
.product-section h2::after {
content: "";
position: absolute;
left: -8px;
top: 50%;
transform: translateY(-50%);
width: 18px;
height: 18px;
background: var(--color-primary);
border-radius: 50%;
filter: blur(10px);
opacity: 0.3;
}
/**
* @brief Horizontal Scroll Container
* @details A flexible container that allows horizontal scrolling for product cards.
* Implements CSS scroll snapping and scroll masks to fade edges.
*/
.product-scroll {
display: flex;
gap: 1.25rem;
padding: 0.5rem 2rem 2.5rem;
overflow-x: auto;
overflow-y: hidden;
scroll-snap-type: x mandatory;
-webkit-overflow-scrolling: touch;
scrollbar-width: none;
/* Fade edges on scroll */
mask-image: linear-gradient(90deg, transparent, black 2rem, black calc(100% - 2rem), transparent);
-webkit-mask-image: linear-gradient(90deg, transparent, black 2rem, black calc(100% - 2rem), transparent);
}
/**
* @brief Product Scroll Item
* @details Fixes the width of cards within the scroll container and enables scroll snapping alignments.
*/
.product-scroll .product-card {
flex: 0 0 270px;
scroll-snap-align: start;
}
/**
* @brief Hide Scrollbar
* @details Removes the default scrollbar for Webkit browsers for a cleaner look.
*/
.product-scroll::-webkit-scrollbar {
display: none;
}
/**
* @section RESPONSIVE DESIGN FOR PRODUCT CARDS
*/
/**
* @brief Tablet Breakpoint (max-width: 768px)
* @details Adjusts grid columns, padding, font sizes, and card dimensions for tablet displays.
*/
@media (max-width: 768px) {
/**
* @brief Responsive Product Grid
*/
.product-grid {
grid-template-columns: repeat(auto-fit, 160px);
gap: 0.8rem;
padding: 1rem;
}
/**
* @brief Responsive Product Section Padding
*/
.product-section {
padding: 1.25rem 0 0.25rem;
}
/**
* @brief Responsive Section Title
*/
.product-section h2 {
margin-left: 1rem;
font-size: 1.1rem;
}
/**
* @brief Responsive Horizontal Scroll
*/
.product-scroll {
padding: 0.5rem 1rem 1.5rem;
gap: 0.8rem;
mask-image: linear-gradient(90deg, transparent, black 1rem, black calc(100% - 1rem), transparent);
-webkit-mask-image: linear-gradient(90deg, transparent, black 1rem, black calc(100% - 1rem), transparent);
}
/**
* @brief Responsive Product Scroll Item Size
*/
.product-scroll .product-card {
flex: 0 0 200px;
min-height: 230px;
}
/**
* @brief Responsive Image Dimensions
*/
.product-card img {
height: 130px;
padding: 10px;
}
/**
* @brief Responsive Content Padding
*/
.product-card__content {
padding: 0.75rem 0.9rem 0.85rem;
gap: 0.25rem;
}
/**
* @brief Responsive Title Size
*/
.product-card__content h3 {
font-size: 0.82rem;
}
/**
* @brief Responsive Description Size
* @details Further limits description lines to 2 on tablets.
*/
.product-card__content p {
font-size: 0.72rem;
-webkit-line-clamp: 2;
}
/**
* @brief Responsive Price Size
*/
.product-card__content .price {
font-size: 0.92rem;
}
}
/**
* @brief Mobile Breakpoint (max-width: 480px)
* @details Optimizes layouts for very small screens, converting grids and making cards even smaller.
*/
@media (max-width: 480px) {
/**
* @brief Mobile Strict 2-Column Grid
*/
.product-grid {
grid-template-columns: repeat(2, 1fr);
gap: 0.6rem;
padding: 0.75rem;
}
/**
* @brief Mobile Horizontal Scroll Item
*/
.product-scroll .product-card {
flex: 0 0 170px;
min-height: 210px;
}
/**
* @brief Mobile Card Image
*/
.product-card img {
height: 110px;
padding: 8px;
}
/**
* @brief Mobile Content Padding
*/
.product-card__content {
padding: 0.6rem 0.7rem 0.7rem;
}
/**
* @brief Mobile Title
* @details Limits the title to a single line.
*/
.product-card__content h3 {
font-size: 0.78rem;
-webkit-line-clamp: 1;
}
/**
* @brief Mobile Description
* @details Completely hides the description text on small mobile screens to save space.
*/
.product-card__content p {
display: none;
}
}
/**
* ==========================================================
* @section WISHLIST Vertical List Layout
* ==========================================================
*/
/**
* @brief Wishlist Layout Container
* @details Arranges wishlist items in a vertical, single-column flex column.
*/
.wishlist-grid {
display: flex;
flex-direction: column;
gap: 1rem;
padding: 0.5rem 2rem 2.5rem;
max-width: 900px;
margin: 0 auto;
}
/**
* @brief Wishlist Item Card
* @details Modifies the default product card to a horizontal row layout specifically for the wishlist.
* Ensures an exact height and equal stretching.
*/
.wishlist-card.product-card {
display: flex;
flex-direction: row;
width: 100%;
max-width: 100%;
/* Höhe wieder flacher machen */
height: 110px;
min-height: 110px;
/* Zieht die Elemente im Inneren auf die exakt selbe Höhe! */
align-items: stretch;
/* Verhindert, dass Ecken überstehen */
overflow: hidden;
}
/**
* @brief Wishlist Image Wrapper
* @details Styles the image specifically for the horizontal wishlist layout. Adds a border right
* instead of border bottom, ensuring it takes up full height with contain object-fit.
*/
.wishlist-card.product-card img {
width: 160px;
flex: 0 0 160px;
/* Das Bild-Abteil nimmt immer 100% der Karten-Höhe ein */
height: 100%;
max-height: 100%;
/* 'contain' sorgt dafür, dass das Apple-Produkt komplett sichtbar bleibt */
object-fit: contain;
/* Das ganze linke Abteil wird einheitlich weiß ausgefüllt */
background-color: #ffffff;
/* Innenabstand, damit das Bild nicht am Rand klebt */
padding: 1rem;
border-bottom: none;
border-right: 1px solid var(--border-subtle);
border-radius: var(--radius-lg) 0 0 var(--radius-lg);
/* Nimmt die eigene Hintergrundfarbe für den Hover-Effekt aus dem Weg */
transition: transform var(--transition-smooth);
}
/**
* @brief Wishlist Content Wrapper
* @details Vertically centers text in the available remaining width alongside the image.
*/
.wishlist-card.product-card .product-card__content {
display: flex;
flex-direction: column;
justify-content: center; /* Zentriert den Text perfekt in der Mitte */
padding: 0.5rem 1.5rem;
flex: 1;
}
/**
* @brief Wishlist Hover Animation
* @details Moves the horizontal card slightly to the right entirely with a small scale increment.
*/
.wishlist-card.product-card:hover {
transform: translateX(6px) scale(1.01);
}
/**
* @brief Wishlist Image Hover Zoom
* @details Zooms into the product image when hovering over a wishlist card.
*/
/* Bild-Zoom beim Hovern */
.wishlist-card.product-card:hover img {
transform: scale(1.08);
}
/**
* @brief Staggered entrance animation delays for Wishlist
* @details Sequential entry animations for wishlist items to replicate the staggered scroll effect.
*/
/* Stagger animation for wishlist items */
.wishlist-grid .wishlist-card:nth-child(1) { animation-delay: 0.05s; }
.wishlist-grid .wishlist-card:nth-child(2) { animation-delay: 0.1s; }
.wishlist-grid .wishlist-card:nth-child(3) { animation-delay: 0.15s; }
.wishlist-grid .wishlist-card:nth-child(4) { animation-delay: 0.2s; }
.wishlist-grid .wishlist-card:nth-child(5) { animation-delay: 0.25s; }
.wishlist-grid .wishlist-card:nth-child(6) { animation-delay: 0.3s; }
.wishlist-grid .wishlist-card:nth-child(7) { animation-delay: 0.35s; }
.wishlist-grid .wishlist-card:nth-child(8) { animation-delay: 0.4s; }
/**
* @section RESPONSIVE DESIGN FOR WISHLIST
*/
/**
* @brief Tablet Breakpoint for Wishlist (max-width: 768px)
* @details Shrinks the total height, image size, and adjusts padding/font-size accordingly.
*/
@media (max-width: 768px) {
.wishlist-grid {
padding: 0.5rem 1rem 1.5rem;
gap: 0.8rem;
}
.wishlist-card.product-card {
height: 100px;
}
.wishlist-card.product-card img {
width: 110px;
flex: 0 0 110px;
padding: 10px;
}
.wishlist-card.product-card .product-card__content {
padding: 0.75rem 1rem;
}
.wishlist-card .product-card__content h3 {
font-size: 0.85rem;
}
.wishlist-card .product-card__content p {
font-size: 0.72rem;
-webkit-line-clamp: 2;
}
}
/**
* @brief Mobile Breakpoint for Wishlist (max-width: 480px)
* @details Minimizes the card height and hides descriptions to maximize screen real estate on mobile devices.
*/
@media (max-width: 480px) {
.wishlist-card.product-card {
height: 90px;
}
.wishlist-card.product-card img {
width: 90px;
flex: 0 0 90px;
padding: 8px;
}
.wishlist-card.product-card .product-card__content {
padding: 0.5rem 0.75rem;
}
.wishlist-card .product-card__content h3 {
font-size: 0.78rem;
-webkit-line-clamp: 1;
}
.wishlist-card .product-card__content p {
display: none;
}
}