/* Keep Calm - Calm Coaches (/coaches/). Dark-first immersive wall + per-coach chat.
   Palette mirrors faithful-create tokens; kept local so this page only needs
   cdo-watchtower.css (crisis ribbon) plus this file. */

:root {
  --kcc-bg: #f6f5f0;
  --kcc-panel: #ffffff;
  --kcc-panel-deep: #eef1ec;
  --kcc-ink: #171a18;
  --kcc-muted: #596159;
  --kcc-rule: #cbd2cb;
  /* control border: >=3:1 (WCAG 1.4.11) against the page in BOTH themes, so
     every interactive boundary is perceivable. --kcc-rule stays soft for
     decorative dividers and bubbles. 3.29:1 vs #f6f5f0 / 4.11:1 vs #10140f. */
  --kcc-cborder: #7f8a7f;
  --kcc-accent: #2c5f4e;
  --kcc-accent-soft: #a2d1bf;
  --kcc-accent-ink: #08120d;
}
html[data-mode="batman"] {
  --kcc-bg: #10140f;
  --kcc-panel: #1b211e;
  --kcc-panel-deep: #151a17;
  --kcc-ink: #f3f0e8;
  --kcc-muted: #aab2aa;
  --kcc-rule: #303a34;
  --kcc-cborder: #6b7a6f;
  --kcc-accent: #9ed4bf;
  --kcc-accent-soft: #9ed4bf;
  --kcc-accent-ink: #07110c;
}

.kcc-body, .kcc-body * , .kcc-body *::before, .kcc-body *::after { box-sizing: border-box; }
.kcc-body {
  margin: 0;
  min-height: 100vh;
  background: var(--kcc-bg);
  color: var(--kcc-ink);
  font-family: "Montserrat", system-ui, sans-serif;
  line-height: 1.5;
}
/* :where() keeps these resets at zero specificity so single-class component
   rules below always win. The old ".kcc-body button" form outranked
   ".kcc-filter", ".kcc-hero__start" and friends, forcing page ink or accent
   onto accent fills (the invisible-button trap). Never raise these above
   :where(). */
.kcc-body :where(button, input) { font: inherit; color: inherit; }
.kcc-body :where(a) { color: var(--kcc-accent); }
.kcc-body :focus-visible { outline: 3px solid var(--kcc-accent); outline-offset: 2px; border-radius: 4px; }

.kcc-sr {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}
.kcc-skip {
  position: absolute; left: 12px; top: -60px; z-index: 60;
  padding: 10px 16px; border-radius: 8px;
  background: var(--kcc-accent-soft); color: var(--kcc-accent-ink);
  font-weight: 700; text-decoration: none; transition: top .15s ease;
}
.kcc-skip:focus { top: 12px; }

/* ---- top bar ---- */
.kcc-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid var(--kcc-rule);
}
.kcc-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--kcc-ink); }
.kcc-brand img { width: 30px; height: 30px; }
html[data-mode="batman"] .kcc-brand img { filter: brightness(0) invert(1); }
.kcc-brand span { font-size: 15px; font-weight: 800; letter-spacing: .18em; }
.kcc-top__actions { display: flex; align-items: center; gap: 10px; }
.kcc-how-btn {
  min-height: 42px; padding: 8px 16px; border: 1px solid var(--kcc-cborder);
  border-radius: 999px; background: transparent; color: var(--kcc-muted);
  font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.kcc-how-btn:hover { color: var(--kcc-ink); border-color: var(--kcc-muted); }
.kcc-theme {
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid var(--kcc-cborder); border-radius: 50%;
  background: transparent; cursor: pointer;
}
.kcc-theme svg { width: 18px; fill: currentColor; }

#kcc-root { min-height: 70vh; }
.kcc-loading, .kcc-empty { padding: 80px 24px; text-align: center; color: var(--kcc-muted); }
.kcc-empty button {
  display: block; margin: 18px auto 0; min-height: 44px; padding: 10px 24px;
  border: 1px solid var(--kcc-cborder); border-radius: 999px;
  background: var(--kcc-panel); cursor: pointer; font-weight: 700;
}

/* ---- the wall ---- */
.kcc-hero { padding: clamp(28px, 5vw, 56px) clamp(16px, 3vw, 40px) 26px; max-width: 1100px; }
.kcc-hero h1 { margin: 0; font-size: clamp(30px, 4.5vw, 54px); line-height: 1.06; font-weight: 700; letter-spacing: -.01em; }
.kcc-hero h1 em { font-style: normal; color: var(--kcc-accent); }
.kcc-hero p { margin: 14px 0 0; color: var(--kcc-muted); font-size: clamp(15px, 1.6vw, 18px); max-width: 62ch; }
.kcc-hero .kcc-disclosure { font-size: 13.5px; margin-top: 10px; }
/* "not sure? start here": one obvious action for an overwhelmed first visit */
.kcc-hero__start {
  display: inline-flex; align-items: center; gap: 9px; margin-top: 18px;
  min-height: 48px; padding: 11px 22px; border: 0; border-radius: 999px;
  background: var(--kcc-accent); color: var(--kcc-panel);
  font-size: 15px; font-weight: 800; cursor: pointer; text-decoration: none;
}
html[data-mode="batman"] .kcc-hero__start { color: var(--kcc-accent-ink); }
.kcc-hero__start svg { width: 19px; height: 19px; fill: currentColor; }

/* filter-by-need: cut 56 choices down to one focus area at a time */
.kcc-filters {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 4px clamp(16px, 3vw, 40px) 10px;
}
.kcc-filter {
  min-height: 40px; padding: 8px 15px;
  border: 1px solid var(--kcc-cborder); border-radius: 999px;
  background: transparent; color: var(--kcc-muted);
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.kcc-filter:hover { color: var(--kcc-ink); border-color: var(--kcc-muted); }
.kcc-filter[aria-pressed="true"] {
  background: var(--kcc-accent); color: var(--kcc-panel); border-color: transparent;
}
html[data-mode="batman"] .kcc-filter[aria-pressed="true"] { color: var(--kcc-accent-ink); }

.kcc-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  padding: 8px clamp(16px, 3vw, 40px) 70px;
}
.kcc-tile {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 3 / 4; border-radius: 14px;
  background: var(--kcc-panel-deep);
  text-decoration: none; color: #ffffff;
}
.kcc-tile__img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform .35s ease;
}
.kcc-tile:hover .kcc-tile__img, .kcc-tile:focus-within .kcc-tile__img { transform: scale(1.04); }
/* Heavier bottom scrim so the focus label + name clear 4.5:1 over ANY
   portrait luminance, not just dark ones. */
.kcc-tile::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg,
    rgba(8, 12, 10, 0) 30%,
    rgba(8, 12, 10, .45) 55%,
    rgba(8, 12, 10, .9) 88%,
    rgba(8, 12, 10, .96) 100%);
}
/* full-tile link opens the coach chat; sits under the corner call button */
.kcc-tile__link { position: absolute; inset: 0; z-index: 1; }
.kcc-tile__link:focus-visible { outline-offset: -3px; }
/* corner "start a video call" affordance: always visible (touch-friendly),
   so the marquee live feature is one tap from the wall, not buried in chat */
.kcc-tile__call {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .5); border-radius: 50%;
  background: rgba(8, 12, 10, .62); color: #ffffff; cursor: pointer;
}
.kcc-tile__call:hover { background: rgba(8, 12, 10, .82); border-color: #ffffff; }
.kcc-tile__call svg { width: 20px; height: 20px; fill: currentColor; }
.kcc-tile__meta { position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 2; pointer-events: none; }
.kcc-tile__focus {
  display: block; margin-bottom: 5px;
  font-size: 12.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: color-mix(in srgb, var(--coach-accent, #a2d1bf) 32%, #ffffff);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .85), 0 1px 10px rgba(0, 0, 0, .6);
}
.kcc-tile__name { display: block; font-size: clamp(20px, 2.2vw, 27px); font-weight: 700; line-height: 1.1; text-shadow: 0 1px 3px rgba(0, 0, 0, .8), 0 1px 10px rgba(0, 0, 0, .45); }
.kcc-portrait-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #ffffff; font-size: 84px; font-weight: 800;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .5);
}

/* ---- chat ---- */
.kcc-chat { max-width: 860px; margin: 0 auto; padding: 0 clamp(12px, 3vw, 24px) 24px; }
.kcc-chat__head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; background: var(--kcc-bg);
  border-bottom: 1px solid var(--kcc-rule);
}
.kcc-back {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid var(--kcc-cborder); border-radius: 50%;
  background: transparent; cursor: pointer; text-decoration: none; color: var(--kcc-ink);
}
.kcc-back svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.kcc-chat__id { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.kcc-avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  position: relative; background: var(--kcc-panel-deep);
  border: 2px solid color-mix(in srgb, var(--coach-accent, var(--kcc-accent)) 65%, var(--kcc-bg));
}
.kcc-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kcc-avatar .kcc-portrait-fallback { font-size: 18px; border-radius: 50%; }
.kcc-chat__who { min-width: 0; }
.kcc-chat__name { display: block; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kcc-chat__focus { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--kcc-muted); }
.kcc-callbtns { display: flex; gap: 8px; }
.kcc-iconbtn {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid var(--kcc-cborder); border-radius: 50%;
  background: var(--kcc-panel); cursor: pointer; color: var(--kcc-ink);
}
.kcc-iconbtn:hover { border-color: var(--kcc-accent); color: var(--kcc-accent); }
.kcc-iconbtn svg { width: 19px; height: 19px; fill: currentColor; }
.kcc-iconbtn[aria-pressed="true"] { background: var(--kcc-accent-soft); color: var(--kcc-accent-ink); border-color: transparent; }

.kcc-chat__intro { padding: 20px 2px 4px; }
.kcc-chat__tagline { margin: 0; color: var(--kcc-muted); font-size: 15.5px; max-width: 60ch; }
.kcc-chips { display: flex; flex-wrap: wrap; gap: 9px; padding: 14px 0 6px; }
.kcc-chip {
  min-height: 42px; padding: 9px 16px;
  border: 1px solid var(--kcc-cborder); border-radius: 999px;
  background: var(--kcc-panel); color: var(--kcc-ink);
  font-size: 13.5px; font-weight: 600; cursor: pointer; text-align: left;
}
.kcc-chip:hover { border-color: var(--kcc-accent); }

/* labeled call actions at the top of a coach chat: the live voice/video
   differentiator, one obvious tap once you have picked a coach */
.kcc-callcta { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 0 2px; }
.kcc-callcta__btn {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 46px; padding: 10px 20px; border-radius: 999px;
  font-size: 14.5px; font-weight: 800; cursor: pointer;
}
.kcc-callcta__btn svg { width: 20px; height: 20px; fill: currentColor; }
.kcc-callcta__btn--video { border: 0; background: var(--kcc-accent); color: var(--kcc-panel); }
html[data-mode="batman"] .kcc-callcta__btn--video { color: var(--kcc-accent-ink); }
.kcc-callcta__btn--voice {
  border: 1px solid var(--kcc-cborder); background: transparent; color: var(--kcc-ink);
}
.kcc-callcta__btn--voice:hover { border-color: var(--kcc-accent); color: var(--kcc-accent); }

.kcc-transcript { padding: 10px 0 16px; display: flex; flex-direction: column; gap: 14px; min-height: 30vh; }
.kcc-msg { display: flex; gap: 10px; max-width: 86%; }
.kcc-msg--user { align-self: flex-end; flex-direction: row-reverse; }
.kcc-msg__bubble {
  padding: 11px 15px; border-radius: 16px;
  font-size: 15px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.kcc-msg--coach .kcc-msg__bubble { background: var(--kcc-panel); border: 1px solid var(--kcc-rule); border-bottom-left-radius: 5px; }
.kcc-msg--user .kcc-msg__bubble { background: var(--kcc-accent-soft); color: var(--kcc-accent-ink); border-bottom-right-radius: 5px; }
.kcc-msg--error .kcc-msg__bubble { border-style: dashed; color: var(--kcc-muted); }
.kcc-msg__side { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.kcc-speak {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--kcc-cborder); border-radius: 50%;
  background: transparent; color: var(--kcc-muted); cursor: pointer;
}
.kcc-speak svg { width: 15px; height: 15px; fill: currentColor; }
.kcc-speak:hover { color: var(--kcc-accent); border-color: var(--kcc-accent); }
.kcc-speak[aria-pressed="true"] { background: var(--kcc-accent-soft); color: var(--kcc-accent-ink); border-color: transparent; }
.kcc-resource {
  display: inline-block; margin: 3px 2px; padding: 5px 12px;
  border: 1px solid var(--kcc-accent); border-radius: 999px;
  color: var(--kcc-accent); background: transparent;
  font-size: 13px; font-weight: 700; text-decoration: none;
}
.kcc-resource:hover { background: var(--kcc-accent-soft); color: var(--kcc-accent-ink); }

.kcc-typing { display: inline-flex; gap: 5px; align-items: center; padding: 4px 2px; }
.kcc-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--kcc-muted); animation: kcc-blink 1.1s infinite ease-in-out; }
.kcc-typing i:nth-child(2) { animation-delay: .18s; }
.kcc-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes kcc-blink { 0%, 70%, 100% { opacity: .25; } 35% { opacity: 1; } }

.kcc-inputrow {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 0 max(14px, env(safe-area-inset-bottom));
  background: var(--kcc-bg); border-top: 1px solid var(--kcc-rule);
}
.kcc-inputrow input[type="text"] {
  flex: 1; min-width: 0; min-height: 48px; padding: 10px 18px;
  border: 2px solid var(--kcc-cborder); border-radius: 999px;
  background: var(--kcc-panel); color: var(--kcc-ink); outline: none;
}
.kcc-inputrow input[type="text"]::placeholder { color: var(--kcc-muted); opacity: 1; }
.kcc-inputrow input[type="text"]:focus { border-color: var(--kcc-accent); }
.kcc-send {
  flex: none; width: 48px; height: 48px; display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--kcc-accent-soft); color: var(--kcc-accent-ink);
}
.kcc-send svg { width: 20px; height: 20px; fill: currentColor; }
.kcc-send:disabled { opacity: .45; cursor: not-allowed; }
.kcc-mic { flex: none; width: 48px; height: 48px; }
.kcc-mic.is-rec { background: #b3261e; border-color: #b3261e; color: #ffffff; animation: kcc-pulse 1.4s infinite; }
@keyframes kcc-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(179, 38, 30, .45); } 50% { box-shadow: 0 0 0 9px rgba(179, 38, 30, 0); } }

/* ---- how-it-works dialog ---- */
.kcc-how {
  max-width: min(520px, calc(100vw - 32px)); padding: 26px 28px;
  border: 1px solid var(--kcc-rule); border-radius: 14px;
  background: var(--kcc-panel); color: var(--kcc-ink);
  font-family: "Montserrat", system-ui, sans-serif;
}
.kcc-how::backdrop { background: rgba(8, 12, 10, .6); }
.kcc-how h2 { margin: 0 0 12px; font-size: 21px; }
.kcc-how ul { margin: 0; padding-left: 20px; display: grid; gap: 9px; font-size: 14.5px; color: var(--kcc-muted); }
.kcc-how ul strong { color: var(--kcc-ink); }
.kcc-how__close {
  margin-top: 18px; min-height: 44px; padding: 10px 26px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--kcc-accent-soft); color: var(--kcc-accent-ink); font-weight: 800;
}

/* ---- toast ---- */
.kcc-toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 90; transform: translateX(-50%);
  max-width: min(480px, calc(100vw - 32px)); padding: 11px 18px;
  border-radius: 10px; background: var(--kcc-ink); color: var(--kcc-bg);
  font-size: 14px; font-weight: 700; text-align: center;
}

@media (max-width: 560px) {
  .kcc-wall { grid-template-columns: repeat(2, 1fr); gap: 7px; padding-left: 10px; padding-right: 10px; }
  .kcc-tile { border-radius: 10px; }
  .kcc-chat__focus { display: none; }
  .kcc-msg { max-width: 94%; }
}

@media (prefers-reduced-motion: reduce) {
  .kcc-tile__img, .kcc-skip { transition: none; }
  .kcc-tile:hover .kcc-tile__img, .kcc-tile:focus-visible .kcc-tile__img { transform: none; }
  .kcc-typing i, .kcc-mic.is-rec { animation: none; }
}
