/* ==========================================================================
   RuneCake — site-wide visual comfort layer
   Small, additive touches shared by every page. No layout assumptions are
   changed; everything degrades cleanly if enhance.js does not run.
   ========================================================================== */

/* Reading progress bar (created by enhance.js) */
#rs-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1600;
    height: 3px;
    width: 0;
    max-width: 100%;
    background: linear-gradient(90deg, #8a6b17, #d4af37 45%, #ffe9a3);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.7);
    pointer-events: none;
    transition: width 0.08s linear;
}

/* Back-to-top control (created by enhance.js) */
#rs-to-top {
    position: fixed;
    right: 18px;
    /* Stack above the Live Support pill (bottom 18px) and wheel FAB (bottom 76px). */
    bottom: 142px;
    z-index: 1500;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 2px solid var(--gold, #d4af37);
    border-radius: 50%;
    background: linear-gradient(145deg, #4a2c20, #1b110a);
    color: var(--gold, #d4af37);
    font-family: 'Cinzel', serif;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s, background 0.25s, color 0.25s;
}

#rs-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#rs-to-top:hover,
#rs-to-top:focus-visible {
    background: linear-gradient(145deg, #d4af37, #b8941f);
    color: #2d1810;
}

/* Gentle scroll reveal for explicitly marked artwork. Content stays visible
   when JavaScript is unavailable because the pending state is JS-only. */
.rs-reveal-pending {
    opacity: 0;
    transform: translateY(14px);
}

.rs-reveal-in {
    opacity: 1;
    transform: none;
    transition: opacity 0.55s ease-out, transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Comfort details */
::selection {
    background: rgba(212, 175, 55, 0.35);
    color: #fff8dc;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #ffe9a3;
    outline-offset: 3px;
}

img { max-width: 100%; }

/* Heading permalinks (added by enhance.js to headings with an id) */
.rs-anchor {
    margin-left: 0.45rem;
    font-size: 0.72em;
    text-decoration: none;
    opacity: 0.35;
    transition: opacity 0.2s;
}

.rs-anchor:hover,
.rs-anchor:focus-visible { opacity: 1; }

/* Illustrated section divider, shared across pages */
.site-flourish {
    display: block;
    width: min(320px, 70%);
    height: 18px;
    margin: 1.4rem auto 0.6rem;
    opacity: 0.8;
    pointer-events: none;
}

/* A calmer footer rule */
.site-footer {
    border-top: 1px solid rgba(212, 175, 55, 0.35);
}

/* Slim, themed scrollbar where supported */
html { scrollbar-color: #8a6b17 #17100a; scrollbar-width: thin; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: #17100a; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(#b8941f, #6b4a22);
    border: 2px solid #17100a;
    border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(#d4af37, #8a6b17); }

@media (prefers-reduced-motion: reduce) {
    #rs-progress,
    #rs-to-top,
    .rs-reveal-in { transition: none; }
    .rs-reveal-pending { opacity: 1; transform: none; }
}
