/* Atmosphere: optional presentation for the Citadel Desk. Reusable; loads after desk.css and changes none of its rules.
 *
 * Hooks set by the atmosphere engine (this file only reads them):
 *   body[data-atmosphere-mode="immersive" | "subtle" | "compact"]
 *   body[data-atmosphere-motion="off"]            motion switched off by the person
 *   .citadel-effect-page | -seal | -ink | -file   add to an element to play that effect once, then remove
 *
 * Every effect is brief, runs once, moves only the element it is put on and never covers or blocks the page, so no
 * task waits for it. Effects are off in compact mode, when motion is switched off, and when the device asks for
 * reduced motion. Nothing here plays sound. Colours fall back to the Desk's parchment, olive and brass.
 */
:root{--atmo-time:0s;--atmo-shift:0px;--atmo-ink:var(--ink,#2a2418);--atmo-quiet:var(--quiet,#5d5240);--atmo-card:var(--card,#fbf4e2);--atmo-line:var(--line,#c9b78a);--atmo-brass:var(--brass,#9a7a3c);--atmo-olive:var(--olive-3,#4a5230);--atmo-wine:var(--wine,#6b1f1a)}
body[data-atmosphere-mode=immersive]{--atmo-time:.42s;--atmo-shift:10px}
body[data-atmosphere-mode=subtle]{--atmo-time:.18s;--atmo-shift:4px}
body[data-atmosphere-mode=compact]{--atmo-time:0s;--atmo-shift:0px}

/* ---------- effects: only in immersive or subtle, only while motion is allowed ---------- */
@media (prefers-reduced-motion:no-preference){
 body:is([data-atmosphere-mode=immersive],[data-atmosphere-mode=subtle]):not([data-atmosphere-motion=off]) .citadel-effect-page{animation:citadel-page var(--atmo-time) ease-out 1 both;transform-origin:left center}
 body:is([data-atmosphere-mode=immersive],[data-atmosphere-mode=subtle]):not([data-atmosphere-motion=off]) .citadel-effect-seal{animation:citadel-seal var(--atmo-time) cubic-bezier(.2,.9,.3,1.2) 1 both}
 body:is([data-atmosphere-mode=immersive],[data-atmosphere-mode=subtle]):not([data-atmosphere-motion=off]) .citadel-effect-ink{animation:citadel-ink var(--atmo-time) ease-out 1 both;background-image:linear-gradient(var(--atmo-brass),var(--atmo-brass));background-repeat:no-repeat;background-position:0 100%}
 body:is([data-atmosphere-mode=immersive],[data-atmosphere-mode=subtle]):not([data-atmosphere-motion=off]) .citadel-effect-file{animation:citadel-file var(--atmo-time) ease-in 1 both}
}
/* A page settling into place. */
@keyframes citadel-page{from{opacity:.25;transform:translateX(calc(var(--atmo-shift)*-1)) rotateY(6deg)}to{opacity:1;transform:none}}
/* A seal pressed down: slightly large, then home, with a brass ring that fades. */
@keyframes citadel-seal{from{transform:scale(1.14);box-shadow:0 0 0 0 var(--atmo-brass)}60%{box-shadow:0 0 0 6px transparent}to{transform:none;box-shadow:0 0 0 0 transparent}}
/* Ink taking: the text comes up while a thin brass rule is drawn under it and then lifts away. */
@keyframes citadel-ink{from{opacity:.35;background-size:0 2px}70%{opacity:1;background-size:100% 2px}to{opacity:1;background-size:100% 0}}
/* A dossier slid into its place in the archive. It ends where it began, so layout never jumps. */
@keyframes citadel-file{from{transform:none;opacity:1}45%{transform:translateX(var(--atmo-shift));opacity:.55}to{transform:none;opacity:1}}
/* Belt and braces: whatever else is on the page, these never animate in the three "still" cases. */
body[data-atmosphere-mode=compact] :is(.citadel-effect-page,.citadel-effect-seal,.citadel-effect-ink,.citadel-effect-file),
body[data-atmosphere-motion=off] :is(.citadel-effect-page,.citadel-effect-seal,.citadel-effect-ink,.citadel-effect-file){animation:none!important;transition:none!important}
@media (prefers-reduced-motion:reduce){:is(.citadel-effect-page,.citadel-effect-seal,.citadel-effect-ink,.citadel-effect-file){animation:none!important;transition:none!important}}

/* ---------- compact: dense. Tighter spacing on the Desk's own blocks; no decoration, no motion ---------- */
body[data-atmosphere-mode=compact]{line-height:1.4}
body[data-atmosphere-mode=compact] main{padding-top:14px;padding-bottom:18px}
body[data-atmosphere-mode=compact] :is(.task,.ov-card,.board,.archive-filter){padding:10px 12px;margin-bottom:8px}
body[data-atmosphere-mode=compact] .dossier{gap:8px;padding-bottom:10px}
body[data-atmosphere-mode=compact] .dossier-head{padding:8px 12px}
body[data-atmosphere-mode=compact] :is(.archive-entry,.thread,.ov-list li){margin-top:.3rem;margin-bottom:.3rem}
body[data-atmosphere-mode=compact] :is(.lede,.queue-sub){margin-bottom:8px}
body[data-atmosphere-mode=compact] .atmosphere-maester-figure{display:none}

/* ---------- the panel ---------- */
.atmosphere-panel{display:grid;gap:14px;max-width:62ch;padding:18px 20px;border:1px solid var(--atmo-brass);border-radius:10px;background:var(--atmo-card);color:var(--atmo-ink);font:16px/1.5 Georgia,'Times New Roman',serif}
.atmosphere-title{margin:0;font:400 1.45rem/1.2 Georgia,'Times New Roman',serif}
.atmosphere-lede{margin:0;color:var(--atmo-quiet);font-style:italic}
.atmosphere-group{margin:0;padding:12px 14px 14px;border:1px solid var(--atmo-line);border-radius:8px;display:grid;gap:10px;min-width:0}
.atmosphere-group>legend{padding:0 6px;font:600 .78rem system-ui,sans-serif;letter-spacing:.12em;text-transform:uppercase;color:var(--atmo-quiet)}
.atmosphere-modes{grid-template-columns:repeat(3,minmax(0,1fr))}
.atmosphere-mode{display:flex;gap:10px;align-items:flex-start;min-height:48px;padding:10px 12px;border:1px solid var(--atmo-line);border-radius:8px;background:#fffaf0;cursor:pointer}
.atmosphere-mode input{flex:none;width:18px;height:18px;margin:3px 0 0;accent-color:var(--atmo-olive)}
.atmosphere-mode-text{display:grid;gap:2px;min-width:0}.atmosphere-mode-text strong{font-weight:600}.atmosphere-mode-text small{color:var(--atmo-quiet);font-size:.86rem;line-height:1.35}
.atmosphere-mode:has(input:checked){border-color:var(--atmo-olive);background:#eef0dc;box-shadow:inset 0 0 0 1px var(--atmo-olive)}
.atmosphere-mode:has(input:focus-visible),.atmosphere-check:has(input:focus-visible){outline:3px solid #7a5b12;outline-offset:2px}
.atmosphere-toggle{display:grid;gap:2px}
.atmosphere-check{display:flex;gap:10px;align-items:center;min-height:44px;cursor:pointer;font-size:1.02rem}
.atmosphere-check input{flex:none;width:20px;height:20px;margin:0;accent-color:var(--atmo-olive)}
.atmosphere-check:has(input:disabled),.atmosphere-mode:has(input:disabled){cursor:not-allowed;opacity:.6}
.atmosphere-help{color:var(--atmo-quiet);font-size:.88rem;line-height:1.4}.atmosphere-toggle .atmosphere-help{padding-left:30px}p.atmosphere-help{margin:0}
.atmosphere-volume{display:grid;grid-template-columns:auto minmax(0,1fr) 3.2em;gap:10px;align-items:center;min-height:44px}
.atmosphere-volume label{font:600 .9rem system-ui,sans-serif}.atmosphere-volume input{width:100%;min-height:28px;accent-color:var(--atmo-olive)}
.atmosphere-volume input:focus-visible{outline:3px solid #7a5b12;outline-offset:3px}.atmosphere-volume input:disabled{opacity:.5}
.atmosphere-volume-out{text-align:right;font:600 .88rem system-ui,sans-serif;color:var(--atmo-quiet)}
.atmosphere-state{margin:0;padding:6px 10px;border-left:3px solid var(--atmo-brass);background:#f6ecd2;border-radius:0 6px 6px 0;font-size:.92rem}.atmosphere-state:empty{display:none}
.atmosphere-preview-buttons{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.atmosphere-preview{min-height:44px;padding:8px 10px;border:1px solid var(--atmo-brass);border-radius:6px;background:#fffaf0;color:var(--atmo-ink);font:600 .9rem system-ui,sans-serif;cursor:pointer}
.atmosphere-preview:hover:not(:disabled){background:#f3e8cf}.atmosphere-preview:focus-visible{outline:3px solid #7a5b12;outline-offset:2px}.atmosphere-preview:disabled{opacity:.5;cursor:not-allowed}
.atmosphere-maester-figure{display:grid;grid-template-columns:auto minmax(0,1fr);gap:4px 12px;align-items:center;padding:10px 12px;border:1px dashed var(--atmo-line);border-radius:8px;background:#fffaf0}
.atmosphere-maester-sigil{grid-row:1/3;display:grid;place-items:center;width:42px;height:42px;border-radius:50%;background:var(--atmo-olive);color:#f3e7c3;border:2px solid var(--atmo-brass);font:400 1.25rem Georgia,serif}
.atmosphere-maester-note{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}.atmosphere-maester-note:empty{display:none}
.atmosphere-maester-empty{margin:0;color:var(--atmo-quiet);font-style:italic;font-size:.92rem}
/* The "no note" line gives way as soon as the Desk puts a summary in the slot. */
.atmosphere-maester-note:not(:empty)+.atmosphere-maester-empty{display:none}
.atmosphere-status{margin:0;padding:8px 12px;border-left:4px solid var(--atmo-wine);background:#fbeeee;border-radius:0 6px 6px 0;font-size:.95rem}.atmosphere-status:empty{display:none}
.atmosphere-panel [hidden]{display:none!important}
@media (max-width:700px){.atmosphere-panel{padding:14px}.atmosphere-modes{grid-template-columns:minmax(0,1fr)}.atmosphere-preview-buttons{grid-template-columns:repeat(2,minmax(0,1fr))}.atmosphere-volume{grid-template-columns:minmax(0,1fr) 3.2em}.atmosphere-volume label{grid-column:1/-1}}
