/* ============================================================================
   coe-chat.css · Center of Excellence — production-grade HR chat
   Loads AFTER demo/tokens.css + demo/copilot.css and re-skins them to the
   Amity production palette (#04BE8C), then adds the page chrome, intro rail,
   suggested chips, citation cards and the guided-tour layer.
   ========================================================================== */

/* ---- Palette override → Amity production green (matches the deck + the
        manufacturing reference). The zip shipped a softer mint (#7BC9B8). ---- */
:root {
  --mint: #04BE8C;
  --mint-hover: #03A77B;
  --mint-700: #03a87b;
  --mint-ink: #036b4d;   /* WCAG-AA dark green for small accent TEXT on white/tint (>=4.5:1) */
  --mint-600: #0bb986;
  --mint-tint: #e8f9f3;
  --mint-tint-2: #f3fbf8;
  --ink: #0E1410;
  --softer: #FAFBFA;
  --line: #E6EBE8;
  --line-soft: #EEF1EF;
  --text-dim: #5A635F;
  --text-soft: #8A948F;

  --font-display: 'Manrope', 'IBM Plex Sans Thai', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  --r-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  --shadow-mint: 0 4px 14px rgba(4, 190, 140, .18), 0 14px 40px rgba(4, 168, 123, .20);
}

/* tokens.css resets list-style to none globally — restore markers inside answers */
.chat__bubble--assistant ul { list-style: disc; }
.chat__bubble--assistant ol { list-style: decimal; }
.chat__bubble--assistant li { margin-left: 2px; }
/* darken table header so white header text clears WCAG AA (white on #04BE8C was 2.4:1) */
.chat__bubble--assistant thead { background: #036b4d; }
.chat__bubble--assistant th { border-bottom-color: #036b4d; }

/* clean production background (tokens.css ships a warm paper bg) */
body {
  background: var(--softer);
  background-image: none;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================================
   Topbar
   ========================================================================== */
.coe-top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.coe-top__brand img { height: 22px; }
.coe-top__title {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  padding-left: 14px;
  margin-left: 4px;
  border-left: 1px solid var(--line);
}
.coe-top__title b {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -.01em;
  color: var(--text-1);
}
.coe-top__title span { font-size: 11.5px; color: var(--text-soft); }
.coe-top__spacer { flex: 1; }

.coe-stamp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  background: var(--soft, #f7f8f7);
  border: 1px solid var(--line);
  padding: 5px 11px;
  border-radius: 999px;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(4, 190, 140, .55);
  animation: coe-pulse 2s infinite;
}
@keyframes coe-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(4, 190, 140, .5); }
  70%  { box-shadow: 0 0 0 7px rgba(4, 190, 140, 0); }
  100% { box-shadow: 0 0 0 0 rgba(4, 190, 140, 0); }
}

/* segmented TH/EN toggle */
.lang-pill {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}
.lang-pill button {
  padding: 6px 11px;
  color: var(--text-soft);
  transition: background .15s ease, color .15s ease;
}
.lang-pill button.is-active { background: var(--ink); color: #fff; }

.coe-top__back,
.coe-top__guide {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-2);
  transition: transform .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}
.coe-top__back:hover { color: var(--text-1); transform: translateX(-2px); }
.coe-top__guide {
  border-color: transparent;
  background: var(--ink);
  color: #fff;
}
.coe-top__guide:hover { background: #000; transform: translateY(-1px); box-shadow: var(--shadow); }
.coe-top__guide .live-dot { background: #fff; }
.coe-top__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--mint-600), var(--mint-700));
}

/* ============================================================================
   Stage: intro rail + chat
   ========================================================================== */
.coe-stage {
  flex: 1;
  display: grid;
  grid-template-columns: 372px 1fr;
  gap: 0;
  min-height: 0;
}

/* ---- Intro rail ---- */
.coe-rail {
  border-right: 1px solid var(--line);
  background:
    radial-gradient(circle at 12% 8%, rgba(4, 190, 140, .05), transparent 42%),
    #fff;
  padding: 30px 28px 36px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.coe-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mint-ink);
  background: var(--mint-tint);
  padding: 5px 11px;
  border-radius: 999px;
}
.coe-rail h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(26px, 1.4rem + 1vw, 33px);
  line-height: 1.08;
  letter-spacing: -.02em;
  color: var(--text-1);
}
.coe-rail h1 .mint { color: var(--mint-700); }
.coe-rail__lede { font-size: 14px; line-height: 1.6; color: var(--text-dim); }

/* benchmark stat pair */
.coe-bench {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.coe-bench__cell {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  background: var(--mint-tint-2);
}
.coe-bench__cell b {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -.01em;
  color: var(--text-1);
}
.coe-bench__cell span { font-size: 11.5px; color: var(--text-dim); }

/* feature list */
.coe-feats { display: flex; flex-direction: column; gap: 9px; }
.coe-feat {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
}
.coe-feat svg {
  width: 17px; height: 17px;
  flex-shrink: 0;
  margin-top: 1px;
  stroke: var(--mint-700);
  fill: none;
  stroke-width: 2.2;
}
.coe-feat b { color: var(--text-1); font-weight: 600; }

/* channel chips */
.coe-channels { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.coe-channel {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 9px;
}
.coe-rail__foot {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-soft);
  line-height: 1.6;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

/* ---- Chat column ---- */
.coe-chatwrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
/* the reused .copilot fills the column */
.coe-chatwrap .copilot {
  min-height: 0;
  flex: 1;
}

/* suggested chips (shown above the input before the first turn) */
.coe-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  max-width: 760px;
  justify-content: center;
}
.copilot.is-chat .coe-chips,
.coe-chips.is-hidden { display: none; }
.coe-chip {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 15px;
  transition: transform .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.coe-chip:hover {
  transform: translateY(-1px);
  border-color: var(--mint);
  color: var(--mint-700);
  box-shadow: 0 4px 12px rgba(4, 190, 140, .12);
}
.coe-chip__ico { margin-right: 6px; }

/* ============================================================================
   Citation cards (slide in under an answer)
   ========================================================================== */
.coe-cite {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 4px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--mint);
  border-radius: 0 12px 12px 0;
  background: var(--mint-tint-2);
  max-width: 100%;
  animation: coe-cite-in .4s cubic-bezier(.2, .7, .2, 1) backwards;
}
@keyframes coe-cite-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.coe-cite__ico {
  width: 30px; height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  display: grid; place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 14px;
}
.coe-cite__meta { min-width: 0; }
.coe-cite__title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-1);
}
.coe-cite__sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
}
.coe-cite__tag {
  margin-left: auto;
  align-self: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--mint-ink);
  background: var(--mint-tint);
  padding: 3px 7px;
  border-radius: 6px;
  flex-shrink: 0;
}

/* ============================================================================
   Guided tour (spotlight ring + tooltip)
   ========================================================================== */
.tour-ring {
  position: fixed;
  z-index: 9998;
  border-radius: 14px;
  border: 2px solid var(--mint);
  box-shadow: 0 0 0 9999px rgba(8, 14, 11, .60);
  pointer-events: none;
  transition: top .35s cubic-bezier(.2, .7, .2, 1),
              left .35s cubic-bezier(.2, .7, .2, 1),
              width .35s cubic-bezier(.2, .7, .2, 1),
              height .35s cubic-bezier(.2, .7, .2, 1);
}
.tour-ring[hidden] { display: none; }

.tour-pop {
  position: fixed;
  z-index: 9999;
  width: min(340px, calc(100vw - 32px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .12), 0 40px 80px rgba(0, 0, 0, .22);
  padding: 18px 18px 14px;
  animation: tour-pop-in .3s cubic-bezier(.2, .7, .2, 1);
}
@keyframes tour-pop-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.tour-pop[hidden] { display: none; }
.tour-pop__step {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--mint-ink);
}
.tour-pop__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.01em;
  color: var(--text-1);
  margin: 4px 0 8px;
}
.tour-pop__row {
  display: flex;
  gap: 9px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 7px;
}
.tour-pop__row svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; stroke-width: 2.2; fill: none; }
.tour-pop__row.why svg { stroke: var(--mint-700); }
.tour-pop__row.how svg { stroke: var(--text-soft); }
.tour-pop__row b { color: var(--text-1); }
.tour-pop__row span { color: var(--text-dim); }
.tour-pop__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.tour-dots { display: flex; gap: 5px; margin-right: auto; }
.tour-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--line);
  transition: background .2s ease, transform .2s ease;
}
.tour-dots i.is-on { background: var(--mint); transform: scale(1.3); }
.tour-btn {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  transition: background .15s ease, transform .15s ease, color .15s ease;
}
.tour-btn--ghost { color: var(--text-soft); }
.tour-btn--ghost:hover { color: var(--text-1); }
.tour-btn--next {
  background: var(--mint);
  color: #fff;
}
.tour-btn--next:hover { background: var(--mint-hover); transform: translateY(-1px); }

/* ============================================================================
   Responsive
   ========================================================================== */
@media (max-width: 940px) {
  /* stack as normal block flow — no grid height distribution, no vertical
     centering in a tall box (that caused the chat greeting to float up
     and overlap the rail) */
  .coe-stage { display: block; }
  .coe-rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 22px 20px 24px;
    overflow: visible;
  }
  .coe-chatwrap { display: block; }
  .coe-chatwrap .copilot {
    min-height: auto;
    justify-content: flex-start;
    padding: 26px 16px 32px;
  }
  .coe-chatwrap .copilot.is-chat .chat__messages { overflow: visible; }
  .coe-rail__foot { display: none; }
  .coe-top__title { display: none; }
}
@media (max-width: 600px) {
  .coe-top { padding: 10px 14px; gap: 9px; }
  .coe-stamp,
  .coe-top__back span,
  #guideBtnLabel { display: none; }       /* icon-only guide + back on phones */
  .coe-top__guide { padding: 8px 11px; }
  .coe-bench { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  /* kill motion entirely — incl. infinite pulse/shimmer/caret that would
     otherwise flash rapidly at a near-zero duration */
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
