/**
 * painted_card.css
 * 🖼️ The look every quote card on the painted canvas shares — the landing's Quote of the Day and the wisdom card's teaching
 * (static/js/painted_card.js builds them): the masterpiece that tells the quote drifting slowly behind the card, under the
 * same veils, golden dust and museum plaque as the World Clock, the Hall of Wisdom and the Immersive Reader (the canvas itself
 * is world_clock.css's .wc-canvas), a dark base with a gold hairline and a thin gold mat inside the edge, and at the foot the
 * plaque and the switch between the painting and the card's classic look. Each card's own sheet (qotd_painting.css,
 * teaching_painting.css) adds its words, buttons and spacing and loads after this one.
 * The script adds these classes to the card:
 *   .awq-card      the card, once painted_card.js has set it up (its palette lives here)
 *   .has-quote     a quote has been shown: the foot (plaque + background switch) appears
 *   .is-painted    the painting background is on (the switch's choice); off = the card's classic look
 *   .is-offscreen  the card is out of view: the drift and the dust rest
 * Both landing cards sit under active_theory_landing.css, whose rules use !important: the painted look wins by specificity.
 */

/* ---------- the card's palette (the full-screen screens define theirs on .wc-root) ---------- */
.awq-card {
    --u: 1;
    --wc-gold: #ffd700;
    --wc-gold-warm: #ffd98a;
    --wc-base: #030604;
    --wc-hairline: rgba(255, 210, 122, 0.34);
    --wc-hairline-faint: rgba(255, 210, 122, 0.18);
    --wc-cream: #f3e9d2;
    --wc-cream-soft: rgba(243, 233, 210, 0.86);
    --wc-label: rgba(255, 217, 138, 0.8);
    --wc-serif: 'Baskerville', 'Baskervville', 'Libre Baskerville', 'Hoefler Text', Georgia, 'Times New Roman', serif;
    --wc-mono: 'Space Mono', ui-monospace, 'SF Mono', Menlo, 'Courier New', monospace;
}

/* ---------- the canvas: only while the painting background is on ---------- */
.awq-card > .awq-canvas {
    z-index: 0;
}

.awq-card:not(.is-painted) > .awq-canvas {
    display: none;
}

/* the text stays readable over any masterpiece: a soft darkening gathered behind the words, lighter towards the edges */
.awq-veil {
    background: radial-gradient(ellipse 90% 78% at 50% 46%, rgba(3, 6, 4, 0.26) 0%, rgba(3, 6, 4, 0.17) 58%, rgba(3, 6, 4, 0.06) 100%);
}

/* the dust rises through the card (the screens' own motes rise through the window) */
.awq-canvas .wc-dust i {
    animation-name: awq-mote;
}

@keyframes awq-mote {
    0% { opacity: 0; transform: translate3d(0, calc(var(--awq-h, 560px) * 0.98), 0); }
    15% { opacity: var(--peak); }
    70% { opacity: calc(var(--peak) * 0.6); }
    100% { opacity: 0; transform: translate3d(var(--sway), calc(var(--awq-h, 560px) * 0.1), 0); }
}

/* out of view, or behind a full-screen painted screen: the drift and the dust rest */
.awq-card.is-offscreen .wc-painting,
.awq-card.is-offscreen .wc-dust i,
html.wc-lock .awq-card .wc-painting,
html.wc-lock .awq-card .wc-dust i {
    animation-play-state: paused;
}

.awq-card.is-offscreen .wc-painting {
    will-change: auto;
}

/* ---------- the painted card ---------- */
.awq-card.is-painted {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: var(--wc-base) !important;
    border: 1px solid var(--wc-hairline) !important;
    border-radius: 16px !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.55), 0 0 44px rgba(255, 215, 0, 0.06) !important;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* the cards' own ornaments (the parchment's paper grain, the wisdom card's big quotation marks) have no place on a painting */
.awq-card.is-painted::before {
    display: none;
}

/* a thin gold mat inside the edge, like a framed picture */
.awq-card.is-painted::after {
    content: '';
    position: absolute;
    inset: 7px;
    z-index: 1;
    width: auto;
    height: auto;
    border: 1px solid var(--wc-hairline-faint);
    border-radius: 10px;
    opacity: 1;
    transform: none;
    text-shadow: none;
    pointer-events: none;
}

/* everything the card holds stands above the canvas and the mat */
.awq-card.is-painted > :not(.awq-canvas) {
    position: relative;
    z-index: 2;
}

/* ---------- the foot: the painting's museum plaque, and the switch between the painting and the classic look ---------- */
.awq-card > .awq-foot {
    position: relative;
    z-index: 2;
}

.awq-foot {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 1.1rem;
    padding: 0 56px;
}

.awq-card.has-quote > .awq-foot {
    display: flex;
}

.awq-plaque {
    margin: 0;
    padding: 0;
    text-wrap: balance;
}

/* beside the switch the credit has less room than on a full-screen painted screen: its byline may wrap instead of running under the button */
.awq-plaque .wc-plaque-by {
    white-space: normal;
}

.awq-card:not(.is-painted) .awq-plaque {
    display: none;
}

/* with the plaque away only the switch is left: the foot closes up around it */
.awq-card:not(.is-painted) > .awq-foot {
    margin-top: 0.4rem;
}

.awq-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.awq-switch {
    margin: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.awq-switch:focus-visible {
    outline: 2px solid var(--wc-gold);
    outline-offset: 2px;
}

/* ---------- a narrow screen: the plaque takes what the switch leaves (instead of a centred column with room kept on both
   sides), so a long credit wraps in fewer lines ---------- */
@media (max-width: 560px) {
    .awq-foot {
        padding: 0;
        gap: 0.5rem;
    }

    .awq-plaque {
        flex: 1 1 0;
        min-width: 0;
    }

    .awq-toggle {
        position: relative;
        top: auto;
        right: auto;
        transform: none;
        flex: none;
    }

    .awq-card:not(.is-painted) > .awq-foot {
        justify-content: flex-end;
    }
}

/* ---------- on paper the painting stays home ---------- */
@media print {
    .awq-card > .awq-canvas,
    .awq-card > .awq-foot {
        display: none !important;
    }

    .awq-card.is-painted {
        background: #fff !important;
        border-color: #000 !important;
        box-shadow: none !important;
    }

    .awq-card.is-painted::after {
        display: none;
    }
}
