/* ════════════════════════════════════════════════════════════════════════════════
   WP-14 — Weya FAB shell (launch site, plain CSS, no pulse)
   WP-R4 — Adds offered-suggestion surface via shared SafeRoomCard (hero+FAB
   consistency, bounded 2, honest empty/degraded, no urgency).
   Collapsed, silent, no badge, no attention-seeking motion. Signed-in only.
   Respects prefers-reduced-motion and [data-motion="reduce"].
   ════════════════════════════════════════════════════════════════════════════════ */

/* ─── FAB root — lives inside #hero, positioned at hero's bottom-right ─── */
.weya-fab-root {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}
.weya-fab-root[hidden] {
  display: none !important;
}

/* The hero provides the positioning context */
#hero {
  position: relative;
}

/* ─── FAB button — small, quiet, no pulse ─── */
.weya-fab {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 44px;
  border-radius: 999px;
  border: 1.5px solid rgba(45, 212, 191, 0.28);
  background: rgba(15, 21, 32, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(45, 212, 191, 0.06);
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  user-select: none;
}
.weya-fab:hover {
  background: rgba(45, 212, 191, 0.14);
  border-color: rgba(45, 212, 191, 0.45);
  transform: translateY(-1px);
}
.weya-fab:active {
  transform: translateY(0);
}
.weya-fab:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.weya-fab[aria-expanded="true"] {
  background: var(--teal);
  color: #04121a;
  border-color: var(--teal);
}
.weya-fab-icon {
  font-size: 1rem;
  line-height: 1;
}
.weya-fab-icon-img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.weya-fab-icon-fallback .weya-fab-icon::after {
  content: '✦';
  font-size: 1rem;
  line-height: 1;
}
/* FAB-PRESENCE (DR-2026-09-16-03): primary height context — filled ~52px
   ONLY on the funnel surface with no rooms panel (the FAB is the only action
   there). Home keeps the quiet 44px pill. No motion (reduced-motion safe). */
.weya-fab--primary .weya-fab {
  min-height: 52px;
  padding: 12px 22px;
  background: var(--teal);
  color: #04121a;
  border-color: var(--teal);
}
/* FAB-PRESENCE (DR-2026-09-16-03): once-only presence tip. Static, high
   contrast, dismissable; hidden by default, shown once via JS. The FAB root
   is already positioned, so the tip anchors to it. */
.weya-fab-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  max-width: 240px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(10, 18, 30, 0.96);
  border: 1px solid rgba(45, 212, 191, 0.28);
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.4;
  pointer-events: none;
  white-space: normal;
}
.weya-fab-text {
  line-height: 1;
}

/* DR-2026-09-23-04 (Ruling N): the away state — Weya is active in a room, so
   the launch-site FAB dims to a way-finder. opacity only: it stays focusable
   and clickable (never `disabled` — that kills the keyboard path), keeps its
   :focus-visible ring, and opens a small disclosure naming the room with a
   link to it. No motion, so it is reduced-motion safe by construction. */
.weya-fab--away .weya-fab {
  opacity: 0.5;
}
/* The away disclosure reuses .weya-fab-tip's chrome but holds a link, so it
   must catch the pointer (the base tip is pointer-events: none). */
.weya-fab-tip--presence {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  max-width: 260px;
}
.weya-fab-tip-msg {
  color: var(--text);
}
.weya-fab-tip-link {
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--teal);
  border: 1px solid rgba(45, 212, 191, 0.45);
  border-radius: 999px;
  padding: 5px 12px;
}
.weya-fab-tip-link:hover {
  background: rgba(45, 212, 191, 0.14);
}
.weya-fab-tip-link:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* ─── Panel — disclosure surface ─── */
.weya-fab-panel {
  pointer-events: auto;
  position: absolute;
  bottom: 58px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: min(68vh, 560px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, #0f1520 0%, #0d1117 100%);
  border: 1px solid rgba(45, 212, 191, 0.16);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(45, 212, 191, 0.06);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.weya-fab-panel.open {
  opacity: 1;
  transform: none;
}
.weya-fab-panel[hidden] {
  display: none !important;
}
.weya-fab-panel-inner {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: inherit;
}
.weya-fab-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
  /* W27 §3 frost: header/edges use the .hero-bubble-slot material,
     byte-identical (rgba(10,18,30,0.88) + blur(12px)); body region stays on
     the opaque gradient below (hero-video contrast rule). */
  /* QA10 frost audit (DR-2026-09-13-01): 0.88 let light-section backgrounds
     bleed through enough to drop muted copy to 4.91:1 (below AA). 0.92 keeps
     the frost look, restores the muted token to 5.9:1+ over ANY page content -
     and matches the DR-2026-09-05-04 ruling's own words (opaque body). */
  background: rgba(10, 18, 30, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.weya-fab-panel-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
}

/* PD2 / W27 §2.4 — the `+` creation control. SILENT but PROMINENT:
   silent = no badge, no pulse, no count, no glow, no timer, no tooltip, no
   auto-anything, zero animation keyframes — it never initiates.
   prominent = visible affordance, unmistakable meaning, 44px hit area,
   keyboard-locatable focus ring, static hover responses only. Visual
   vocabulary is the existing .weya-fab teal border treatment — no new
   accent, no solid fill, does not compete with the FAB itself. */
.weya-fab-new-room {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 44px;
  border-radius: 999px;
  border: 1.5px solid rgba(45, 212, 191, 0.28);
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.18s ease, border-color 0.18s ease;
  user-select: none;
}
.weya-fab-new-room:hover {
  background: rgba(45, 212, 191, 0.14);
  border-color: rgba(45, 212, 191, 0.45);
}
.weya-fab-new-room:active {
  background: rgba(45, 212, 191, 0.18);
}
.weya-fab-new-room:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.weya-fab-new-room-icon {
  font-size: 1rem;
  line-height: 1;
}
.weya-fab-close {
  background: rgba(45, 212, 191, 0.08);
  border: 1.5px solid rgba(45, 212, 191, 0.25);
  color: var(--teal);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.weya-fab-close:hover {
  background: rgba(45, 212, 191, 0.18);
  border-color: var(--teal);
}
.weya-fab-close:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.weya-fab-intro {
  margin: 0;
  padding: 12px 18px 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.weya-fab-body {
  padding: 14px 18px 16px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(45, 212, 191, 0.15) transparent;
}
.weya-fab-body::-webkit-scrollbar {
  width: 4px;
}
.weya-fab-body::-webkit-scrollbar-thumb {
  background: rgba(45, 212, 191, 0.2);
  border-radius: 2px;
}

/* Actions stack */
.weya-fab-actions {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.weya-fab-action {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
}
.weya-fab-action-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}
.weya-fab-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.weya-fab-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.weya-fab-input::placeholder {
  color: var(--text-dim);
}
.weya-fab-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
}
.weya-fab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  min-height: 40px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--cyan), var(--teal));
  color: #06101a;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
  box-shadow: 0 4px 16px rgba(45, 212, 191, 0.28);
}
.weya-fab-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(45, 212, 191, 0.4);
}
.weya-fab-btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: none;
}
.weya-fab-btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.weya-fab-btn-ghost {
  background: transparent;
  color: var(--teal);
  border: 1.5px solid rgba(45, 212, 191, 0.35);
  box-shadow: none;
  width: 100%;
}
.weya-fab-btn-ghost:hover {
  background: rgba(45, 212, 191, 0.08);
  box-shadow: none;
  transform: none;
}
.weya-fab-status {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-muted);
  min-height: 1.2em;
}
.weya-fab-status.error {
  color: #f87171;
}
.weya-fab-status.ok {
  color: var(--teal);
}
.weya-fab-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.weya-fab-card {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
}
.weya-fab-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}
.weya-fab-card-purpose {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.weya-fab-card-fit {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 6px;
}
.weya-fab-card-req {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.weya-fab-card-join {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(45, 212, 191, 0.35);
  background: transparent;
  color: var(--teal);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.weya-fab-card-join:hover {
  background: rgba(45, 212, 191, 0.1);
}
.weya-fab-card-join:disabled {
  opacity: 0.5;
  cursor: default;
}
.weya-fab-card-join.joined {
  background: rgba(45, 212, 191, 0.14);
  border-color: var(--teal);
  color: var(--teal);
}
.weya-fab-card-msg {
  font-size: 0.78rem;
  line-height: 1.45;
  margin-top: 6px;
  color: var(--text-muted);
}
.weya-fab-card-msg.error {
  color: #f87171;
}
.weya-fab-card-msg.joined-msg {
  color: var(--teal);
}
.weya-fab-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 2px 0;
}
.weya-fab-foot-note {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-dim);
  text-align: center;
  padding: 0 4px;
}

/* Founder ruling 2026-09-09: subtle capabilities note (bottom of FAB panel).
   Quiet foot-note idiom — dim, small, centered; the dismiss ✕ inherits color.
   PD2-G2: relocated INSIDE the conversation, under Weya's opening line —
   styling unchanged (quiet, never loud). */
.weya-fab-capability-note {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-dim);
  text-align: center;
  padding: 8px 4px 2px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* ── PD2 / W27 Phase 1 — the conversation surface ── */
.weya-chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 220px;
}
.weya-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 0;
  overflow-y: auto;
  min-height: 0;
  max-height: 300px;
  scrollbar-width: thin;
  scrollbar-color: rgba(45, 212, 191, 0.15) transparent;
}
.weya-chat-messages::-webkit-scrollbar {
  width: 4px;
}
.weya-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(45, 212, 191, 0.2);
  border-radius: 2px;
}
.weya-chat-opening {
  display: block;
}
.weya-chat-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.87rem;
  line-height: 1.45;
  word-wrap: break-word;
}
/* DR-2026-09-23-03 (Ruling I, launch-site collision option a): Weya's bubble
   takes a stronger FILLED teal, clearly separated by weight from the member's
   14%-alpha tint at :555 below. Matches the teal accents already on this
   surface: .weya-label (hero.css:171) and the typing dots (:579). The member's
   bubble is unchanged. */
.weya-chat-msg-assistant {
  align-self: flex-start;
  background: rgba(45, 212, 191, 0.22);
  border: 1px solid rgba(45, 212, 191, 0.45);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
/* DR-2026-09-23-03 (Ruling I, V2): the Weya label above her bubble. Reuses
   .weya-label's chrome (hero.css:171 - 13px, 700, var(--teal), 0.04em) and the
   ✦ glyph precedent at :83. Static - no motion, reduced-motion safe. */
.weya-chat-msg-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: 0.04em;
  padding: 0 2px 2px;
  align-self: flex-start;
}
.weya-chat-msg-label::before {
  content: '✦';
  font-size: 0.6rem;
  margin-right: 4px;
}
.weya-chat-msg-user {
  align-self: flex-end;
  background: rgba(45, 212, 191, 0.14);
  border: 1px solid rgba(45, 212, 191, 0.22);
  color: var(--text);
  border-bottom-right-radius: 4px;
}
.weya-chat-typing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
}
.weya-chat-typing-text {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.weya-chat-typing-dots {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}
.weya-typing-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--teal);
  display: inline-block;
  opacity: 0.4;
  animation: weyaTypingDot 1.2s ease-in-out infinite;
}
.weya-typing-dot:nth-child(2) { animation-delay: 150ms; }
.weya-typing-dot:nth-child(3) { animation-delay: 300ms; }
@keyframes weyaTypingDot {
  0%, 80%, 100% { opacity: 0.4; }
  40% { opacity: 1; }
}
/* W27 §1 signup gate: the finish-signup affordance replaces the composer
   for a profile-less member — she does not speak to them. */
.weya-chat-signup-gate {
  padding: 8px 0;
}
.weya-chat-gate-note {
  margin: 0 0 10px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.weya-chat-gate-btn {
  width: 100%;
}
.weya-chat-composer {
  display: flex;
  gap: 8px;
  align-items: center;
}
.weya-chat-input {
  flex: 1 1 auto;
}
.weya-chat-send {
  flex-shrink: 0;
}
.weya-chat-status {
  min-height: 1.2em;
}
/* OFD-57 (PD2-G1): matches render as PLAIN TEXT room names — one quiet line
   each, no cards. */
.weya-fab-create-matches {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.weya-fab-create-matches:empty {
  display: none;
}
.weya-fab-create-match {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted);
  padding-left: 4px;
}

/* W27 §3 requirement 2: opaque fallback when the member asks the system
   for reduced transparency. The frost is decorative, never informational. */
@media (prefers-reduced-transparency: reduce) {
  .weya-fab-panel-header {
    background: #0a121e;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* WP-R4 — FAB suggestions wrap (populated via SafeRoomCard) */
.weya-fab-suggestions {
  margin-bottom: 12px;
}
.weya-fab-suggestions:empty {
  display: none;
}

/* Reduced motion — no transitions, no transform animation, no typing dots */
@media (prefers-reduced-motion: reduce) {
  .weya-fab,
  .weya-fab-panel,
  .weya-fab-new-room,
  .weya-typing-dot {
    transition: none !important;
    animation: none !important;
  }
  .weya-typing-dot {
    opacity: 0.8;
  }
}
:root[data-motion="reduce"] .weya-fab,
:root[data-motion="reduce"] .weya-fab-panel,
:root[data-motion="reduce"] .weya-fab-new-room,
:root[data-motion="reduce"] .weya-typing-dot {
  transition: none !important;
  animation: none !important;
}
:root[data-motion="reduce"] .weya-typing-dot {
  opacity: 0.8;
}

/* Responsive — keep panel readable and FAB clear of sticky CTA */
/* F-47 (review 2026-09-13, P1): the root was position:absolute INSIDE #hero —
   after the member scrolls past the hero, Weya did not exist, and the
   Take-me-to-Weya button clicked a control that could be off-screen. At
   ≤768px the root goes fixed so the FAB follows the member through the page;
   safe-area-inset keeps it clear of gesture bars. z-index 9400 sits above
   page content and below the s5 modal (9700) / funnel modal (9600). */
@media (max-width: 768px) {
  .weya-fab-root {
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom));
    right: 12px;
    z-index: 9400;
  }
  .weya-fab-panel {
    width: calc(100vw - 24px);
    right: 0;
    bottom: 56px;
    max-height: min(62vh, 520px);
  }
}
@media (max-width: 480px) {
  .weya-fab {
    padding: 9px 14px;
    font-size: 0.85rem;
  }
  .weya-fab-panel {
    max-height: 58vh;
  }
  .weya-fab-row {
    flex-direction: column;
    align-items: stretch;
  }
  .weya-fab-row .weya-fab-btn {
    width: 100%;
  }
}
