/* Furniture every shelf style shares (spec 2026-10-11): the brass plaque
   naming a compartment, and the theme's decor. */

/* Brass plaque with two rivets; the style positions it. */
.shelf-plaque {
    overflow: hidden;
    padding: 4px 18px 5px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--shelf-brass-hi) 0%, var(--shelf-brass) 50%, var(--shelf-brass-lo) 130%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 3px 6px rgba(0, 0, 0, 0.55);
    color: var(--shelf-plaque-ink);
    font: 600 0.8rem/1.2 "Cinzel", var(--font-family-display);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Two brass rivets. */
.shelf-plaque::before,
.shelf-plaque::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 5px;
    height: 5px;
    margin-top: -2.5px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, var(--shelf-brass-hi), var(--shelf-brass-lo));
    box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.35);
}

.shelf-plaque::before { left: 6px; }
.shelf-plaque::after { right: 6px; }

/* Bookshelf decor per theme (spec 2026-10-11 §4/§5): two objects at the
   cabinet's edge, rendered from CC0 Poly Haven models
   (images/shelf-decor/CREDITS.md, tools/render-decor). Used by the shelf
   styles through .shelf-decor--left / --right; --decor is the picture,
   --decor-h its height at full size. Kept in one file (not the theme files)
   so the url()s resolve against this stylesheet. */

.shelf-decor {
    position: absolute;
    z-index: 2;
    width: 240px;
    /* a touch smaller than the pictures, so decor accents and never crowds */
    height: calc(var(--decor-h, 0px) * 0.8);
    background: var(--decor, none) center bottom / contain no-repeat;
    pointer-events: none;
}

html[data-theme="classic-library"] .shelf-decor--left { --decor: url("../images/shelf-decor/mantel-clock.webp"); --decor-h: 96px; }
html[data-theme="classic-library"] .shelf-decor--right { --decor: url("../images/shelf-decor/candelabra.webp"); --decor-h: 150px; }
html[data-theme="dark-library"] .shelf-decor--left { --decor: url("../images/shelf-decor/marble-bust.webp"); --decor-h: 138px; }
html[data-theme="dark-library"] .shelf-decor--right { --decor: url("../images/shelf-decor/ship-lantern.webp"); --decor-h: 140px; }
html[data-theme="skriptorium"] .shelf-decor--left { --decor: url("../images/shelf-decor/wooden-candlestick.webp"); --decor-h: 132px; }
html[data-theme="skriptorium"] .shelf-decor--right { --decor: url("../images/shelf-decor/brass-pot.webp"); --decor-h: 78px; }
html[data-theme="alexandria"] .shelf-decor--left { --decor: url("../images/shelf-decor/marble-bust.webp"); --decor-h: 138px; }
html[data-theme="alexandria"] .shelf-decor--right { --decor: url("../images/shelf-decor/brass-vase.webp"); --decor-h: 150px; }
html[data-theme="babylon"] .shelf-decor--left { --decor: url("../images/shelf-decor/brass-pot.webp"); --decor-h: 80px; }
html[data-theme="babylon"] .shelf-decor--right { --decor: url("../images/shelf-decor/brass-goblets.webp"); --decor-h: 76px; }
html[data-theme="ischtar"] .shelf-decor--left { --decor: url("../images/shelf-decor/antique-vase.webp"); --decor-h: 130px; }
html[data-theme="ischtar"] .shelf-decor--right { --decor: url("../images/shelf-decor/brass-goblets.webp"); --decor-h: 76px; }
html[data-theme="abendhafen"] .shelf-decor--left { --decor: url("../images/shelf-decor/compass.webp"); --decor-h: 96px; }
html[data-theme="abendhafen"] .shelf-decor--right { --decor: url("../images/shelf-decor/ship-lantern.webp"); --decor-h: 140px; }
html[data-theme="daemmergarten"] .shelf-decor--left { --decor: url("../images/shelf-decor/potted-plant-02.webp"); --decor-h: 118px; }
html[data-theme="daemmergarten"] .shelf-decor--right { --decor: url("../images/shelf-decor/wooden-lantern.webp"); --decor-h: 118px; }
html[data-theme="nachtgarten"] .shelf-decor--left { --decor: url("../images/shelf-decor/potted-plant-04.webp"); --decor-h: 108px; }
html[data-theme="nachtgarten"] .shelf-decor--right { --decor: url("../images/shelf-decor/wooden-lantern.webp"); --decor-h: 118px; }
html[data-theme="modern-light"] .shelf-decor--left { --decor: url("../images/shelf-decor/potted-plant-04.webp"); --decor-h: 108px; }
html[data-theme="modern-light"] .shelf-decor--right { --decor: url("../images/shelf-decor/ceramic-vase-01.webp"); --decor-h: 120px; }

@media (prefers-color-scheme: light) {
    html[data-theme="system"] .shelf-decor--left { --decor: url("../images/shelf-decor/potted-plant-04.webp"); --decor-h: 108px; }
    html[data-theme="system"] .shelf-decor--right { --decor: url("../images/shelf-decor/ceramic-vase-01.webp"); --decor-h: 120px; }
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] .shelf-decor--left { --decor: url("../images/shelf-decor/marble-bust.webp"); --decor-h: 138px; }
    html[data-theme="system"] .shelf-decor--right { --decor: url("../images/shelf-decor/ship-lantern.webp"); --decor-h: 140px; }
}

/* Warm light from a candle or lantern among the decor, on the wall behind
   and the cornice under it. Only where the decor is a light. */
.shelf-decor-glow {
    position: absolute;
    z-index: 1;
    width: 420px;
    height: 300px;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(ellipse at 72% 62%, rgba(255, 186, 96, 0.22), transparent 62%);
}

html[data-theme="classic-library"] .shelf-decor-glow,
html[data-theme="dark-library"] .shelf-decor-glow,
html[data-theme="abendhafen"] .shelf-decor-glow,
html[data-theme="daemmergarten"] .shelf-decor-glow,
html[data-theme="nachtgarten"] .shelf-decor-glow {
    opacity: 1;
    animation: shelf-decor-flicker 3.4s infinite ease-in-out;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] .shelf-decor-glow {
        opacity: 1;
        animation: shelf-decor-flicker 3.4s infinite ease-in-out;
    }
}

@keyframes shelf-decor-flicker {
    0%, 100% { opacity: 1; }
    30% { opacity: 0.82; }
    55% { opacity: 0.95; }
    75% { opacity: 0.78; }
}

@media (prefers-reduced-motion: reduce) {
    .shelf-decor-glow {
        animation: none !important;
    }
}
