[WV2] Make show.css a bit more manageable

This commit is contained in:
Emi Matchu 2026-02-05 18:43:02 -08:00
parent e694bc5d05
commit 4503c12a1f

View file

@ -1,5 +1,10 @@
@import "../application/item-badges.css"; @import "../application/item-badges.css";
/* ===================================================================
Shared Components
Buttons, item cards, pagination, and other reusable patterns.
=================================================================== */
/* Base button defaults - applied to all interactive controls */ /* Base button defaults - applied to all interactive controls */
button, button,
input[type="submit"], input[type="submit"],
@ -124,6 +129,68 @@ select,
} }
} }
/* Item card - shared layout for worn items and search results */
.item-card {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.75rem;
background: #f9f9f9;
margin-bottom: 0.5rem;
border-radius: 8px;
color: #333;
transition: background 0.2s, box-shadow 0.2s;
position: relative;
&:hover {
background: #f0f0f0;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
&:hover :is(.item-add-button, .item-remove-button) {
opacity: 1;
}
.item-thumbnail {
flex-shrink: 0;
width: 50px;
height: 50px;
border-radius: 6px;
overflow: hidden;
background: white;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
img {
width: 100%;
height: 100%;
object-fit: contain;
display: block;
}
}
.item-info {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.item-name {
font-weight: 500;
color: #2D3748;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.item-badges {
display: flex;
gap: 0.375rem;
flex-wrap: wrap;
}
}
/* Pagination links - treated as buttons for consistency */ /* Pagination links - treated as buttons for consistency */
.pagination { .pagination {
a, a,
@ -169,6 +236,11 @@ select,
} }
} }
/* ===================================================================
Page Layout
Top-level grid: preview on left/top, controls on right/bottom.
=================================================================== */
body.wardrobe-v2 { body.wardrobe-v2 {
margin: 0; margin: 0;
padding: 0; padding: 0;
@ -197,6 +269,11 @@ body.wardrobe-v2 {
} }
} }
/* ===================================================================
Outfit Preview
Left/top panel: outfit viewer, floating controls, pose picker.
=================================================================== */
.outfit-preview-section { .outfit-preview-section {
grid-area: preview; grid-area: preview;
display: flex; display: flex;
@ -292,7 +369,76 @@ body.wardrobe-v2 {
display: none; display: none;
} }
/* Pose picker button */ /* Species/color picker */
species-color-picker {
display: contents;
form {
display: contents;
}
select {
padding: 0.5rem 2rem 0.5rem 0.75rem;
font-size: 1rem;
appearance: none;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
background-position: right 0.5rem center;
background-repeat: no-repeat;
background-size: 1.5em 1.5em;
option {
background: #2D3748;
color: white;
}
}
/* Submit button: progressive enhancement pattern */
/* If JS is disabled, the button is always visible */
/* If JS is enabled but slow to load, fade in after 0.75s */
/* Once the web component loads, hide the button completely */
input[type="submit"] {
padding: 0.5rem 1rem;
font-size: 1rem;
}
/* If JS is enabled, hide the submit button initially with a delay */
@media (scripting: enabled) {
input[type="submit"] {
position: absolute;
margin-left: 0.5em;
opacity: 0;
animation: fade-in 0.25s forwards;
animation-delay: 0.75s;
}
}
/* Once auto-loading is ready, hide the submit button completely */
&:state(auto-loading) {
input[type="submit"] {
display: none;
}
}
}
/* Show controls on hover (real hover only, not simulated touch hover) */
@media (hover: hover) {
&:hover .preview-controls {
opacity: 1;
}
}
/* Show controls when they have focus or when popover is open */
&:has(.preview-controls:focus-within) .preview-controls,
&:has(.pose-picker-button[popovertargetopen]) .preview-controls {
opacity: 1;
}
}
/* ===================================================================
Pose Picker Popover
Floating panel for choosing expression/pose and alt styles.
=================================================================== */
.pose-picker-button { .pose-picker-button {
anchor-name: --pose-picker-anchor; anchor-name: --pose-picker-anchor;
display: flex; display: flex;
@ -321,7 +467,6 @@ body.wardrobe-v2 {
} }
} }
/* Pose picker popover */
pose-picker-popover { pose-picker-popover {
position: absolute; position: absolute;
position-anchor: --pose-picker-anchor; position-anchor: --pose-picker-anchor;
@ -594,70 +739,10 @@ body.wardrobe-v2 {
} }
} }
/* Species/color picker */ /* ===================================================================
species-color-picker { Outfit Controls
display: contents; Right/bottom panel: worn items, search, and results.
=================================================================== */
form {
display: contents;
}
select {
padding: 0.5rem 2rem 0.5rem 0.75rem;
font-size: 1rem;
appearance: none;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
background-position: right 0.5rem center;
background-repeat: no-repeat;
background-size: 1.5em 1.5em;
option {
background: #2D3748;
color: white;
}
}
/* Submit button: progressive enhancement pattern */
/* If JS is disabled, the button is always visible */
/* If JS is enabled but slow to load, fade in after 0.75s */
/* Once the web component loads, hide the button completely */
input[type="submit"] {
padding: 0.5rem 1rem;
font-size: 1rem;
}
/* If JS is enabled, hide the submit button initially with a delay */
@media (scripting: enabled) {
input[type="submit"] {
position: absolute;
margin-left: 0.5em;
opacity: 0;
animation: fade-in 0.25s forwards;
animation-delay: 0.75s;
}
}
/* Once auto-loading is ready, hide the submit button completely */
&:state(auto-loading) {
input[type="submit"] {
display: none;
}
}
}
/* Show controls on hover (real hover only, not simulated touch hover) */
@media (hover: hover) {
&:hover .preview-controls {
opacity: 1;
}
}
/* Show controls when they have focus or when popover is open */
&:has(.preview-controls:focus-within) .preview-controls,
&:has(.pose-picker-button[popovertargetopen]) .preview-controls {
opacity: 1;
}
}
.outfit-controls-section { .outfit-controls-section {
grid-area: controls; grid-area: controls;
@ -710,70 +795,6 @@ body.wardrobe-v2 {
padding: 0; padding: 0;
margin: 0.5rem 0; margin: 0.5rem 0;
} }
.item-card {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.75rem;
background: #f9f9f9;
margin-bottom: 0.5rem;
border-radius: 8px;
color: #333;
transition: background 0.2s, box-shadow 0.2s;
position: relative;
&:hover {
background: #f0f0f0;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
&:hover .item-remove-button {
opacity: 1;
}
}
.item-thumbnail {
flex-shrink: 0;
width: 50px;
height: 50px;
border-radius: 6px;
overflow: hidden;
background: white;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
img {
width: 100%;
height: 100%;
object-fit: contain;
display: block;
}
}
.item-info {
flex: 1;
min-width: 0;
/* Allow text to truncate */
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.item-name {
font-weight: 500;
color: #2D3748;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.item-badges {
display: flex;
gap: 0.375rem;
flex-wrap: wrap;
}
/* .item-remove-button styles are defined in button system above */
} }
.item-search-form { .item-search-form {
@ -801,8 +822,6 @@ body.wardrobe-v2 {
box-shadow: 0 0 0 3px rgba(68, 136, 68, 0.1); box-shadow: 0 0 0 3px rgba(68, 136, 68, 0.1);
} }
} }
/* input[type="submit"] styles are defined in button system above */
} }
} }
@ -811,69 +830,6 @@ body.wardrobe-v2 {
list-style: none; list-style: none;
padding: 0; padding: 0;
margin: 1rem 0; margin: 1rem 0;
.item-card {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.75rem;
background: #f9f9f9;
margin-bottom: 0.5rem;
border-radius: 8px;
color: #333;
transition: background 0.2s, box-shadow 0.2s;
position: relative;
&:hover {
background: #f0f0f0;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
&:hover :is(.item-add-button, .item-remove-button) {
opacity: 1;
}
}
.item-thumbnail {
flex-shrink: 0;
width: 50px;
height: 50px;
border-radius: 6px;
overflow: hidden;
background: white;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
img {
width: 100%;
height: 100%;
object-fit: contain;
display: block;
}
}
.item-info {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.item-name {
font-weight: 500;
color: #2D3748;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.item-badges {
display: flex;
gap: 0.375rem;
flex-wrap: wrap;
}
/* .item-add-button styles are defined in button system above */
} }
.empty-state { .empty-state {
@ -887,10 +843,12 @@ body.wardrobe-v2 {
display: flex; display: flex;
justify-content: center; justify-content: center;
gap: 0.5rem; gap: 0.5rem;
}
}
/* Pagination link styles are defined in button system above */ /* ===================================================================
} Animations
} =================================================================== */
@keyframes fade-in { @keyframes fade-in {
from { from {