/* =========================================================
   The app's altar on the website: living art over objects (living-art.js),
   the panel for a selected object and the altar's tools (altar-living.js,
   altar-workings.js, altar-reading.js), and their sheets.
   ========================================================= */

/* ── Living art ────────────────────────────────────────── */
.altar-object > .living-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.altar-object > .living-art--under { z-index: 0; }
.altar-object > img:first-of-type { position: relative; z-index: 1; }
.altar-object > .living-art--burned { z-index: 2; }
.altar-object > .living-art--marks { z-index: 5; }
.altar-object > .living-art--flame { z-index: 6; }
.altar-object > .living-art--fx { z-index: 6; }
.altar-object > .living-art--paper { z-index: 1; padding: 6% 4%; }
.altar-object.is-petition-paper { font-size: 0; }
.living-art__marks { position: absolute; left: 0; top: 0; overflow: visible; }
.living-art__clip { position: absolute; overflow: hidden; }
.living-art__clip.is-spent img { filter: grayscale(.9) saturate(.2) opacity(.78); }
.altar-object.is-burned-down > img:first-of-type { opacity: 0 !important; }

/* The app's flame replaces the drawn one. The "Spent" word stays. */
.altar-object.has-living-flame.is-lit::before,
.altar-object.has-living-flame.is-lit::after,
.altar-object.has-living-flame.is-extinguishing::after { display: none; }

.living-flame { position: absolute; inset: 0; pointer-events: none; }
.living-flame__fire { position: absolute; width: 10%; overflow: visible; }
.living-flame__fire svg { overflow: visible; display: block; }
.living-flame__halo { position: absolute; width: 8%; transform-origin: 50% 100%; filter: blur(1.5px); }
.living-flame__halo svg { overflow: visible; display: block; }
.living-smoke { position: absolute; width: 10%; pointer-events: none; filter: blur(1px); }

.living-incense > div { position: absolute; pointer-events: none; }
.living-incense__stream { animation: living-sway 5s ease-in-out infinite; }
.living-incense__wisp { opacity: 0; animation: living-wisp 5.6s cubic-bezier(.25,.46,.45,.94) infinite; }
.living-incense__wisp--1 { animation-delay: 1.4s; --wx: 0.2; }
.living-incense__wisp--2 { animation-delay: 2.8s; }
.living-incense__wisp--3 { animation-delay: 4.2s; --wx: 0.2; }
.living-incense__ember { border-radius: 50%; background: rgb(255, 140, 50); box-shadow: 0 0 8px 3px rgba(255, 140, 60, 0.85); }
@keyframes living-sway {
  0%, 100% { transform: translateX(calc(var(--sway) * -1)); }
  48% { transform: translateX(var(--sway)); }
}
@keyframes living-wisp {
  0% { opacity: 0; transform: translate(0, calc(var(--wisp) * -0.4)) scale(.45); }
  12% { opacity: .8; }
  35% { transform: translate(calc(var(--wisp) * -0.18), calc(var(--wisp) * -1.1)) scale(.85); }
  60% { opacity: .45; }
  70% { transform: translate(calc(var(--wisp) * 0.25), calc(var(--wisp) * -2)) scale(1.4); }
  100% { opacity: 0; transform: translate(calc(var(--wisp) * 0.35), calc(var(--wisp) * -2.8)) scale(1.8); }
}
.living-ash { position: absolute; bottom: 1%; left: 22%; width: 56%; height: 5%; border-radius: 999px; background: rgba(150, 146, 138, .85); }
.altar-object.is-incense-ash > img:first-of-type { filter: grayscale(.9) saturate(.2) opacity(.78); }
.living-label {
  position: absolute; left: 50%; bottom: -1.4rem; transform: translateX(-50%);
  padding: .15rem .4rem; border: 1px solid var(--gold, #b89a58); border-radius: 999px;
  background: #241b19; color: #f3e8cf; font-size: .68rem; line-height: 1.3; white-space: nowrap;
}

.living-charge { position: absolute; left: -45%; top: -18%; width: 190%; height: 136%; animation: living-breathe 4.4s ease-in-out infinite; }
.living-glint { position: absolute; margin-left: -8%; margin-top: -8%; aspect-ratio: 1; animation: living-glint 4.4s ease-in-out infinite; }
.living-glint--1 { animation-delay: -2.2s; }
@keyframes living-breathe { 0%, 100% { opacity: .7; } 50% { opacity: 1; } }
@keyframes living-glint { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

.living-moment { position: absolute; inset: 0; pointer-events: none; z-index: 400; }
.living-moment > div { position: absolute; }
.living-moment__wash { animation: living-wash var(--ms) ease-in-out forwards; }
@keyframes living-wash { 0% { opacity: 0; transform: translateY(var(--drop)); } 12% { opacity: 1; } 75% { opacity: .9; } 100% { opacity: 0; transform: translateY(0); } }
.living-moment__ring { border-radius: 50%; border: 2.5px solid rgba(250, 236, 196, .95); box-shadow: 0 0 6px rgba(255, 236, 190, .6); opacity: 0; animation: living-ring var(--ms) ease-in-out forwards; animation-delay: calc(var(--i) * var(--ms) * .18); }
@keyframes living-ring { 0% { opacity: 0; transform: scale(.3); } 10% { opacity: .95; } 100% { opacity: 0; transform: scale(1.8); } }
.living-moment__grain { border-radius: 50%; background: rgb(250, 248, 240); box-shadow: 0 0 3px rgba(255, 255, 255, .8); opacity: 0; animation: living-grain var(--ms) linear forwards; animation-delay: calc(var(--appear) * var(--ms) * .6); }
@keyframes living-grain { 0% { opacity: 0; } 6% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
.living-moment__wisp { opacity: 0; animation: living-moment-wisp var(--ms) ease-in-out forwards; }
@keyframes living-moment-wisp {
  0% { opacity: 0; transform: translate(calc(var(--side) * var(--w) * .35), 0) scale(.6); }
  22% { opacity: .9; }
  30% { transform: translate(calc(var(--side) * var(--w) * -.4), calc(var(--h) * -.3)) scale(.9); }
  60% { transform: translate(calc(var(--side) * var(--w) * .3), calc(var(--h) * -.6)) scale(1.2); }
  75% { opacity: .5; }
  100% { opacity: 0; transform: translate(calc(var(--side) * var(--w) * -.1), calc(var(--h) * -1)) scale(1.6); }
}

/* The sky and the moon window. */
.altar-sky { position: absolute; inset: 0; pointer-events: none; z-index: 1; border-radius: inherit; }
.altar-sky__tint, .altar-sky__season { position: absolute; inset: 0; border-radius: inherit; }
.altar-sky__moon {
  position: absolute; display: grid; place-items: center; border-radius: 50%;
  background: rgba(10, 18, 40, .55); border: 1px solid rgba(226, 195, 109, .35);
}
.altar-snap-guide { position: absolute; pointer-events: none; z-index: 300; }
.altar-snap-guide span { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; color: var(--gold); font-size: .72rem; letter-spacing: .04em; text-shadow: 0 0 3px #000; }

@media (prefers-reduced-motion: reduce) {
  .living-incense__stream, .living-charge, .living-glint { animation: none; }
  .living-incense__wisp { animation: none; opacity: .4; transform: translateY(calc(var(--wisp) * -1)); }
  .living-incense__wisp--2, .living-incense__wisp--3 { display: none; }
  .living-moment > div { animation: none !important; opacity: .8 !important; }
}

/* ── Notice under the stage ────────────────────────────── */
.app-altar-notice {
  margin: 10px auto 0; max-width: 60rem; padding: 0 16px;
  color: var(--gold); text-align: center; font-size: .95rem; line-height: 1.5; cursor: pointer;
}
.app-altar-notice[hidden] { display: none; }

/* ── The altar's tools (the app's chips) ───────────────── */
.app-altar-tools {
  display: grid; gap: 10px; margin: 14px auto 0; max-width: 72rem; padding: 0 4px;
}
.app-altar-tools__intention { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 1.15rem; color: var(--cream); text-align: center; margin: 0; cursor: pointer; }
.app-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.app-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px;
  border: 1px solid rgba(226, 195, 109, .4); border-radius: 999px; padding: 6px 14px;
  background: rgba(17, 21, 18, .55); color: var(--cream); font: inherit; font-size: .92rem; cursor: pointer;
}
.app-chip span[aria-hidden] { color: var(--gold); }
.app-chip:hover, .app-chip:focus-visible { border-color: var(--gold); background: rgba(185, 160, 93, .14); }
.app-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.app-chip[aria-pressed="true"], .app-chip--primary { background: var(--gold); color: var(--charcoal); border-color: var(--gold); }
.app-chip[aria-pressed="true"] span[aria-hidden], .app-chip--primary span[aria-hidden] { color: var(--charcoal); }
.app-chip--danger { border-color: rgba(214, 120, 100, .55); color: #f1c7bb; }
.app-chip:disabled { opacity: .45; cursor: not-allowed; }

/* ── The selected object's living panel ────────────────── */
.app-living {
  display: grid; gap: 12px; padding: 14px 16px 16px; margin: 0 0 12px;
  border: 1px solid rgba(226, 195, 109, .3); border-radius: 16px;
  background: linear-gradient(180deg, rgba(185, 160, 93, .1), rgba(17, 21, 18, .3));
  color: var(--cream);
}
.app-living .app-chips { justify-content: flex-start; }
.app-living__eyebrow, .app-sheet__eyebrow, .app-label {
  margin: 0; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold);
}
.app-living__title { margin: 0; font-family: "Cormorant Garamond", serif; font-size: 1.5rem; font-weight: 600; line-height: 1.15; }
.app-living__glance { margin: 0; font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 1.1rem; color: #eadfc4; }
.app-living__attuned { margin: 0; color: var(--gold); font-weight: 600; font-size: .88rem; }
.app-caption { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.app-block { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.app-block--faded .app-living__eyebrow { color: var(--muted); }
.app-button {
  justify-self: start; min-height: 40px; padding: 8px 18px; border-radius: 999px;
  border: 1px solid var(--gold); background: var(--gold); color: var(--charcoal); font: inherit; font-weight: 600; cursor: pointer;
}
.app-button--outline { background: transparent; color: var(--cream); }
.app-button:hover, .app-button:focus-visible { filter: brightness(1.08); }
.app-button:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; }
.app-button:disabled { opacity: .5; cursor: not-allowed; }
.app-story { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.app-story li { color: var(--muted); font-size: .88rem; line-height: 1.45; }

/* ── Sheets ────────────────────────────────────────────── */
.app-sheet {
  width: min(34rem, calc(100vw - 24px)); max-height: min(88vh, 54rem);
  padding: 0; border: 1px solid rgba(226, 195, 109, .45); border-radius: 18px;
  background: #16201a; color: var(--cream); box-shadow: var(--shadow);
  overflow: hidden;
}
.app-sheet[open] { display: flex; flex-direction: column; }
.app-sheet--wide { width: min(48rem, calc(100vw - 24px)); }
.app-sheet::backdrop { background: rgba(5, 8, 6, .7); }
.app-sheet__head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 18px 10px; border-bottom: 1px solid var(--line); }
.app-sheet__head > div { flex: 1; min-width: 0; }
.app-sheet__title { max-width: none; margin: 2px 0 0; font-family: "Cormorant Garamond", serif; font-size: 1.6rem; font-weight: 600; line-height: 1.15; }
.app-sheet__close {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: transparent; color: var(--cream); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.app-sheet__close:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.app-sheet__body { padding: 14px 18px 22px; overflow-y: auto; display: grid; gap: 14px; align-content: start; }
.app-sheet__body .app-chips { justify-content: flex-start; }
.app-sheet p { margin: 0; line-height: 1.55; }
.app-field { display: grid; gap: 6px; }
.app-field > span, .app-field > label { font-size: .85rem; color: var(--muted); }
.app-field input, .app-field textarea, .app-field select {
  width: 100%; box-sizing: border-box; background: rgba(17, 21, 18, .7); color: var(--cream);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: inherit;
}
.app-field textarea { min-height: 90px; resize: vertical; }
.app-field input:focus-visible, .app-field textarea:focus-visible, .app-field select:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.app-rows { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.app-row {
  display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(17, 21, 18, .35);
}
.app-row__title { font-weight: 600; }
.app-honesty { border-left: 2px solid var(--gold); padding-left: 12px; color: var(--muted); font-size: .88rem; }
.app-closeup { display: grid; place-items: center; min-height: 260px; padding: 30px 0 10px; }
.app-closeup .altar-object { position: relative !important; left: auto !important; top: auto !important; cursor: default; }
.app-jar-visual { display: block; margin: 0 auto; }
.app-scry { display: grid; place-items: center; gap: 14px; text-align: center; }
.app-scry__bowl { width: min(260px, 70vw); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 45%, #1d2a3a 0%, #0b1018 55%, #05070b 100%); box-shadow: inset 0 0 40px rgba(0,0,0,.9), 0 0 0 6px rgba(120, 100, 70, .45); position: relative; overflow: hidden; }
.app-scry__bowl::after { content: ""; position: absolute; inset: 18%; border-radius: 50%; background: radial-gradient(circle at 40% 35%, rgba(220, 230, 255, .18), transparent 60%); animation: living-breathe 7s ease-in-out infinite; }
.app-scry__clock { font-family: "Cormorant Garamond", serif; font-size: 2.2rem; }
.app-share-preview { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }

/* Full screen: the stage fills the screen, its tools in a drawer. */
body.altar-full-screen { overflow: hidden; }
body.altar-full-screen .site-header,
body.altar-full-screen .accessibility-trigger { display: none !important; }
body.altar-full-screen .altar-stage-wrap {
  position: fixed; inset: 0; z-index: 20000; background: #000; display: grid; place-items: center;
  margin: 0; padding: 0; border: 0; border-radius: 0; max-width: none; width: 100vw; height: 100vh;
}
body.altar-full-screen .altar-stage-wrap > :not([data-altar-stage]) { display: none !important; }
body.altar-full-screen .altar-stage { width: min(100vw, calc(100vh * 16 / 9)); max-width: none; margin: 0; }
.altar-full-bar { position: fixed; top: 10px; z-index: 20050; display: flex; gap: 8px; }
.altar-full-bar .app-chips { flex-wrap: nowrap; }
.altar-full-bar--left { left: 10px; }
.altar-full-bar--right { right: 10px; }
@media (max-width: 640px) { .altar-full-bar--right { top: 60px; } }
.altar-full-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 20100; width: min(380px, 92vw); overflow-y: auto;
  background: rgba(12, 21, 16, .95); border-left: 1px solid rgba(226, 195, 109, .35); padding: 12px 14px 24px; box-sizing: border-box;
}
.altar-full-drawer__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }


@media (max-width: 520px) {
  .app-sheet { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .app-chip { font-size: .88rem; padding: 6px 12px; }
}

.app-row > .app-chip, .app-sheet__body > .app-chip { justify-self: start; }
a.app-button { display: inline-flex; align-items: center; text-decoration: none; }

/* Links that look like the app's chips (an object's page in Crystal, Green, Hedge or the Grimoire). */
a.app-chip { text-decoration: none; }
.app-problem { color: #f1c7bb; margin: 4px 0; }
.app-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
