/* =====================================================================
   CELAENO CHAMBER — the room around the reading (30.09.2026, rev 2).
   Presentation layer only.

   The room is a photographic plate (assets/chamber/*.webp): the owner's
   approved chamber — arch, crescent, candles, the round marble table —
   with NO interface baked in. Everything that moves or answers stays
   live HTML on top of it: the conversation on the left, the real Tarot
   blocks that celaeno-visuals.js renders on the table, the Methods
   drawer on the right edge. CSS atmosphere (glow, haze, dust, a few
   pixels of parallax) only supports the plate; it never replaces it.

   Two plates, two compositions:
     desktop.webp  880x854  the wide room; cards land on the table
     mobile.webp   480x854  a portrait framing, lower half darkened so
                            messages and cards stay readable over it
   prefers-reduced-motion stops every animation and the parallax.
   ===================================================================== */
:root {
  --ch-left: calc(var(--pad-x) + min(42%, 620px) + 8px);
  --ch-amber: #e0a85f;
  --px: 0; --py: 0;               /* parallax, set by celaeno-chamber.js */
}

/* ---- desk: conversation keeps the left; the composer stays under it ---- */
@media (min-width: 901px) {
  .celaeno-mode:not(.ui-v2) .pia-text { width: min(42%, 620px); }
  .celaeno-mode:not(.ui-v2) .bottom { right: auto; width: min(42%, 620px); }
}

/* ---- the room ---- */
.chamber { display: none; }
.celaeno-mode:not(.ui-v2) .chamber {
  display: block;
  position: fixed; top: 0; bottom: 0; left: var(--ch-left); right: 0;
  z-index: 1; pointer-events: none; overflow: hidden;
  background: #060506;
  contain: layout paint;
}
.celaeno-mode:not(.ui-v2) .chamber > * { position: absolute; inset: 0; }

/* the plate: slightly oversized so the parallax never shows an edge */
.celaeno-mode:not(.ui-v2) .ch-plate {
  inset: -2%;
  background: url("/assets/chamber/desktop.webp") center bottom / cover no-repeat;
  transform: translate(calc(var(--px) * 6px), calc(var(--py) * 4px));
  will-change: transform;
}
/* the room recedes from the panel: a hairline and a soft shadow at the seam */
.celaeno-mode:not(.ui-v2) .chamber::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 120px; z-index: 2;
  background: linear-gradient(90deg, rgba(4,3,4,.85), transparent);
}
.celaeno-mode:not(.ui-v2) .chamber::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; z-index: 3;
  background: rgba(184,137,78,.16);
}

/* ---- atmosphere on top of the plate (enhancement only) ---- */
.celaeno-mode:not(.ui-v2) .ch-haze { opacity: .35; filter: blur(30px); }
.celaeno-mode:not(.ui-v2) .ch-haze i {
  position: absolute; display: block; border-radius: 50%;
  background: radial-gradient(circle, rgba(224,168,95,.14), transparent 70%);
}
.celaeno-mode:not(.ui-v2) .ch-haze i:nth-child(1) { width: 44%; height: 34%; left: 10%; top: 50%; animation: ch-drift 46s ease-in-out infinite; }
.celaeno-mode:not(.ui-v2) .ch-haze i:nth-child(2) { width: 36%; height: 30%; left: 50%; top: 38%; animation: ch-drift 58s ease-in-out infinite reverse; }
@keyframes ch-drift { 0%,100% { transform: translate(0,0) } 50% { transform: translate(6%, -5%) } }

.celaeno-mode:not(.ui-v2) .ch-glow {
  background:
    radial-gradient(34% 22% at 50% 66%, rgba(224,168,95,.16), transparent 70%),
    radial-gradient(26% 20% at 12% 62%, rgba(224,168,95,.10), transparent 70%),
    radial-gradient(26% 20% at 88% 62%, rgba(224,168,95,.10), transparent 70%);
  transform: translate(calc(var(--px) * 9px), calc(var(--py) * 6px));
  animation: ch-candle 5.5s ease-in-out infinite;
}
@keyframes ch-candle { 0%,100% { opacity: .9 } 38% { opacity: 1 } 64% { opacity: .78 } }

.celaeno-mode:not(.ui-v2) .ch-dust i {
  position: absolute; display: block; width: 2px; height: 2px; border-radius: 50%;
  background: rgba(232,201,135,.7); box-shadow: 0 0 4px rgba(232,201,135,.5);
  opacity: 0; bottom: 30%;
  animation: ch-mote var(--d, 26s) linear infinite var(--o, 0s);
}
.celaeno-mode:not(.ui-v2) .ch-dust i:nth-child(1)  { left: 14%; --d: 27s; --o: -3s }
.celaeno-mode:not(.ui-v2) .ch-dust i:nth-child(2)  { left: 21%; --d: 34s; --o: -11s }
.celaeno-mode:not(.ui-v2) .ch-dust i:nth-child(3)  { left: 27%; --d: 22s; --o: -7s }
.celaeno-mode:not(.ui-v2) .ch-dust i:nth-child(4)  { left: 33%; --d: 31s; --o: -19s }
.celaeno-mode:not(.ui-v2) .ch-dust i:nth-child(5)  { left: 41%; --d: 25s; --o: -1s }
.celaeno-mode:not(.ui-v2) .ch-dust i:nth-child(6)  { left: 47%; --d: 36s; --o: -14s }
.celaeno-mode:not(.ui-v2) .ch-dust i:nth-child(7)  { left: 52%; --d: 29s; --o: -22s }
.celaeno-mode:not(.ui-v2) .ch-dust i:nth-child(8)  { left: 58%; --d: 24s; --o: -5s }
.celaeno-mode:not(.ui-v2) .ch-dust i:nth-child(9)  { left: 63%; --d: 33s; --o: -16s }
.celaeno-mode:not(.ui-v2) .ch-dust i:nth-child(10) { left: 69%; --d: 21s; --o: -9s }
.celaeno-mode:not(.ui-v2) .ch-dust i:nth-child(11) { left: 74%; --d: 30s; --o: -25s }
.celaeno-mode:not(.ui-v2) .ch-dust i:nth-child(12) { left: 80%; --d: 26s; --o: -12s }
.celaeno-mode:not(.ui-v2) .ch-dust i:nth-child(13) { left: 86%; --d: 35s; --o: -20s }
.celaeno-mode:not(.ui-v2) .ch-dust i:nth-child(14) { left: 91%; --d: 23s; --o: -4s }
@keyframes ch-mote {
  0%   { transform: translate(0, 0);        opacity: 0 }
  12%  { opacity: .5 }
  60%  { opacity: .28 }
  100% { transform: translate(14px, -46vh); opacity: 0 }
}
/* the shade only exists on a phone (below) */
.celaeno-mode:not(.ui-v2) .ch-shade { display: none; }

/* ---- the result surface: real cards on the marble ----
   #chamber-stage is the host celaeno-visuals.js appends to on a desk (on a
   phone it appends into the conversation). Same blocks, same ids, same
   aria-live. The surface ends where the tabletop is in the plate, so the
   newest block rests ON the table; older readings stay above it and
   scroll within this surface. */
.celaeno-mode:not(.ui-v2) #chamber-stage { display: none; }
@media (min-width: 901px) {
  .celaeno-mode:not(.ui-v2) #chamber-stage {
    display: flex; flex-direction: column; gap: 18px;
    position: fixed; left: calc(var(--ch-left) + 5%); right: max(12%, 104px);
    top: 88px; bottom: 27vh; z-index: 11;
    padding: 10px 12px 0; overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: rgba(212,165,116,.22) transparent;
  }
  .celaeno-mode:not(.ui-v2) #chamber-stage .oracle-visuals { width: 100%; max-width: none; margin: 0; }
  .celaeno-mode:not(.ui-v2) #chamber-stage > .oracle-visuals:first-child { margin-top: auto; }
  /* on the marble the panel is almost glass: the table shows through */
  .celaeno-mode:not(.ui-v2) #chamber-stage .oracle-visual {
    background: linear-gradient(160deg, rgba(14,11,11,.34), rgba(6,5,7,.46));
    border-color: rgba(184,137,78,.22);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    box-shadow: 0 30px 60px rgba(0,0,0,.6), inset 0 1px rgba(255,255,255,.03);
    padding: 12px 14px 14px;
  }
  .celaeno-mode:not(.ui-v2) #chamber-stage .cv-card {
    box-shadow: 0 22px 36px rgba(0,0,0,.65), 0 0 24px rgba(224,168,95,.08), inset 0 0 0 4px rgba(2,2,3,.38);
  }
  /* a row of 1–5 fits in one row on the table */
  .celaeno-mode:not(.ui-v2) #chamber-stage .cv-spread { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 12px; }
  .celaeno-mode:not(.ui-v2) #chamber-stage .cv-spread .cv-card { max-width: 172px; min-height: 0; }
  .celaeno-mode:not(.ui-v2) #chamber-stage .cv-spread.is-single { grid-template-columns: min(172px, 60%); }
  .celaeno-mode:not(.ui-v2) #chamber-stage .cv-spread .cv-card-name { font-size: 12px; }
  .celaeno-mode:not(.ui-v2) #chamber-stage .cv-spread .cv-card-position, .celaeno-mode:not(.ui-v2) #chamber-stage .cv-spread .cv-card-state { font-size: 7px; letter-spacing: .1em; }
  /* the cabinet's thinking table hangs in the arch, above the reading */
  .celaeno-mode:not(.ui-v2) .oracle-table { top: 18%; right: max(12%, 104px); }
  /* the voice CTA keeps its handler and its right edge, only lower, in
     front of the table's foot, so it never covers a card */
  .celaeno-mode:not(.ui-v2) .speak-cta { bottom: 40px; }
}

/* ---- phone: a portrait room behind a primary conversation ----
   Its own plate (not the desk one cropped), darkened below the table in
   the asset itself; a further shade keeps bubbles and cards legible.
   The Methods pill moves up under the header — the selector is near the
   top, as in the mobile design — with the same button and handler. */
@media (max-width: 900px) {
  .celaeno-mode:not(.ui-v2) .chamber { left: 0; right: 0; }
  .celaeno-mode:not(.ui-v2) .ch-plate {
    inset: 0; transform: none;
    background: url("/assets/chamber/mobile.webp") center top / cover no-repeat;
  }
  .celaeno-mode:not(.ui-v2) .chamber::before, .celaeno-mode:not(.ui-v2) .chamber::after { display: none; }
  .celaeno-mode:not(.ui-v2) .ch-haze, .celaeno-mode:not(.ui-v2) .ch-dust { display: none; }
  .celaeno-mode:not(.ui-v2) .ch-glow { animation: none; transform: none;
    background: radial-gradient(60% 24% at 50% 96%, rgba(224,168,95,.14), transparent 70%); }
  .celaeno-mode:not(.ui-v2) .ch-shade { display: block;
    background: linear-gradient(180deg, rgba(6,5,6,.10) 0%, rgba(6,5,6,.34) 38%, rgba(6,5,6,.72) 62%, rgba(6,5,6,.86) 100%); }
  /* larger cards, still one swipeable row, still snapping */
  .celaeno-mode:not(.ui-v2) .cv-spread { grid-auto-columns: 56%; }
}
@media (max-width: 700px) {
  .celaeno-mode:not(.ui-v2) .method-handle {
    top: calc(56px + env(safe-area-inset-top)); bottom: auto;
    left: auto; right: max(14px, env(safe-area-inset-right));
    background: rgba(10,8,9,.78); border-color: rgba(212,165,116,.4); opacity: .9;
  }
}

/* ---- stillness on request ---- */
@media (prefers-reduced-motion: reduce) {
  .celaeno-mode:not(.ui-v2) .ch-haze i, .celaeno-mode:not(.ui-v2) .ch-glow, .celaeno-mode:not(.ui-v2) .ch-dust i { animation: none; }
  .celaeno-mode:not(.ui-v2) .ch-dust { display: none; }
  .celaeno-mode:not(.ui-v2) .ch-plate, .celaeno-mode:not(.ui-v2) .ch-glow { transform: none; }
}
