/* RUSE live chat (assets/js/chat.js). Bottom-left on ruse.co.za and on previews. */
.rc {
  --rc-bg: #0b0b0a;
  --rc-fg: var(--fg, #ededea);
  --rc-dim: var(--dim, #8a8a85);
  --rc-line: var(--line, rgba(255, 255, 255, 0.1));
  --rc-signal: var(--signal, #ff3b1f);
  --rc-gap: var(--gutter, 24px);
  --rc-bottom: calc(var(--rc-gap) + 40px);   /* main site: clear of the corner labels */
  font-family: var(--text, 'Newsreader', Georgia, serif);
  color: var(--rc-fg);
}
/* Previews: on phones the bar spans the width, so the button sits just above it. */
.live .rc { --rc-gap: 16px; --rc-bottom: var(--bar-gap, 16px); }
@media (max-width: 1100px) { .live .rc { --rc-bottom: var(--above-bar, 82px); } }

.rc-launch {
  position: fixed;
  left: max(var(--rc-gap), env(safe-area-inset-left));
  bottom: var(--rc-bottom);
  z-index: 80; /* above the site's corner labels (50), cursor (55) and grain (60) */
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border: 1px solid var(--rc-line);
  border-radius: 50%;
  background: rgba(10, 10, 9, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--rc-fg);
  cursor: pointer;
  box-shadow: 0 14px 40px -12px rgba(0, 0, 0, 0.6);
  transition: transform 0.3s var(--ease, ease), border-color 0.2s;
}
.rc-launch:hover { border-color: rgba(237, 237, 234, 0.4); transform: translateY(-1px); }
.rc-launch svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.rc.is-open .rc-launch { opacity: 0; pointer-events: none; }
.rc-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 20px; height: 20px; padding: 0 6px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--rc-signal); color: #050505;
  font-size: 11.5px; font-weight: 500; line-height: 1;
}
.rc-badge[hidden] { display: none; }

/* A reply arrived while the chat was closed: show it next to the button. */
.rc-peek {
  position: fixed;
  left: max(var(--rc-gap), env(safe-area-inset-left));
  bottom: calc(var(--rc-bottom) + 62px);   /* above the button, clear of the preview bar */
  z-index: 80;
  max-width: min(300px, calc(100vw - 100px));
  padding: 12px 14px;
  border: 1px solid var(--rc-line);
  border-radius: 14px 14px 14px 4px;
  max-width: min(300px, calc(100vw - 24px));
  background: var(--rc-fg); color: #0b0b0a;
  font: 14px/1.45 var(--text, Georgia, serif);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 14px 40px -12px rgba(0, 0, 0, 0.6);
  animation: rcIn 0.4s var(--ease, ease);
}
.rc-peek[hidden] { display: none; }

.rc-panel {
  position: fixed;
  left: max(var(--rc-gap), env(safe-area-inset-left));
  bottom: var(--rc-bottom);
  z-index: 85;
  width: min(370px, calc(100vw - 24px));
  height: min(540px, calc(100dvh - var(--rc-bottom) - 24px));
  display: flex; flex-direction: column;
  border: 1px solid var(--rc-line);
  border-radius: 18px;
  background: var(--rc-bg);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: rcIn 0.35s var(--ease, ease);
}
.rc-panel[hidden] { display: none; }
/* Previews: the open chat sits above the bar, never over it. */
.live .rc-panel { bottom: var(--above-bar, 82px); height: min(540px, calc(100dvh - var(--above-bar, 82px) - 24px)); }
@keyframes rcIn { from { opacity: 0; transform: translateY(10px); } }

.rc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 14px 20px; border-bottom: 1px solid var(--rc-line); }
.rc-title { font-family: var(--serif, 'Instrument Serif', serif); font-size: 26px; line-height: 1; letter-spacing: -0.01em; }
.rc-title span { letter-spacing: 0.04em; }
.rc-status { display: flex; align-items: center; gap: 7px; margin-top: 6px; color: var(--rc-dim); font-size: 13px; }
.rc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rc-dim); }
.rc.is-online .rc-dot { background: var(--rc-signal); box-shadow: 0 0 0 3px rgba(255, 59, 31, 0.18); }
.rc-x { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--rc-dim); cursor: pointer; margin: -4px -6px 0 0; }
.rc-x:hover { color: var(--rc-fg); background: rgba(255, 255, 255, 0.06); }
.rc-x svg, .rc-compose svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.rc-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.rc-log[hidden] { display: none; }
.rc-hello { color: var(--rc-dim); font-size: 14.5px; line-height: 1.5; padding: 2px 4px 6px; }
.rc-msg { max-width: 86%; display: grid; gap: 4px; }
.rc-msg p { padding: 10px 13px; border-radius: 14px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.rc-msg time { font-size: 11.5px; color: var(--rc-dim); padding: 0 4px; }
.rc-me { align-self: flex-end; text-align: right; }
.rc-me p { background: var(--rc-fg); color: #0b0b0a; border-bottom-right-radius: 4px; text-align: left; }
.rc-them { align-self: flex-start; }
.rc-them p { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--rc-line); border-bottom-left-radius: 4px; }
.rc-msg.is-sending { opacity: 0.6; }
.rc-msg.is-failed time { color: var(--rc-signal); }

.rc-start { flex: 1; overflow-y: auto; padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.rc-start[hidden], .rc-compose[hidden] { display: none; }
.rc-intro { color: var(--rc-dim); font-size: 15px; line-height: 1.5; }
.rc-start label { display: grid; gap: 6px; }
.rc-start label span { color: var(--rc-dim); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.rc-start input, .rc-start textarea, .rc-compose textarea {
  width: 100%; min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--rc-line); border-radius: 10px;
  background: transparent; color: var(--rc-fg);
  font: 15px/1.4 var(--text, Georgia, serif);
  resize: none;
}
.rc-start input:focus, .rc-start textarea:focus, .rc-compose textarea:focus { outline: none; border-color: var(--rc-fg); }
.rc-err { color: var(--rc-signal); font-size: 14px; }
.rc-err[hidden] { display: none; }
.rc-go { height: 46px; border: 1px solid var(--rc-fg); border-radius: 999px; background: var(--rc-fg); color: #0b0b0a; font: 13px/1 var(--text, Georgia, serif); letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; }
.rc-go:hover { background: transparent; color: var(--rc-fg); }
.rc-go[disabled] { opacity: 0.5; pointer-events: none; }

.rc-compose { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--rc-line); }
.rc-compose textarea { flex: 1; max-height: 120px; }
.rc-compose button { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--rc-fg); color: #0b0b0a; cursor: pointer; }

/* Phones: the chat opens as a sheet across the bottom of the screen. */
@media (max-width: 640px) {
  .rc { --rc-gap: 12px; }
  .rc:not(.rc-preview) { --rc-bottom: 64px; }
  .rc-launch { width: 48px; height: 48px; }
  .rc-panel { left: 8px; right: 8px; bottom: 8px; width: auto; height: min(560px, calc(100dvh - 16px)); }
  .rc-start input, .rc-start textarea, .rc-compose textarea { font-size: 16px; } /* no iPhone zoom */
}
/* While the keyboard is up, sit right on top of it. */
.rc.is-kb .rc-panel { bottom: calc(var(--rc-kb, 0px) + 8px); height: calc(var(--rc-vh, 100dvh) - 16px); }

@media (prefers-reduced-motion: reduce) { .rc-panel, .rc-peek { animation: none; } }
