/* CC-style glyph + collapse + truncation for Terminal tab.
   All colors reference CSS variables from chat-tokens.css so they follow theme. */

/* ────────────────────────────────────────────────────────────────────────
   Glyph prefixes (10 types mirroring CC components)
   ──────────────────────────────────────────────────────────────────────── */

.cc-glyph {
  font-family: var(--font-mono, monospace);
  display: inline-block;
  width: 1.25em;
  margin-right: 0.4rem;
  text-align: center;
  font-weight: 500;
}

.cc-glyph--user,
.cc-glyph--assistant      { color: var(--color-text, currentColor); }
.cc-glyph--thinking       { color: var(--color-inactive, #888); font-style: italic; }
.cc-glyph--redacted       { color: var(--color-inactive, #888); font-style: italic; opacity: 0.7; }
.cc-glyph--system         { color: var(--color-info, #3B82F6); }
.cc-glyph--duration       { color: var(--color-inactive, #888); }
.cc-glyph--canceled       { color: var(--color-inactive, #888); }
.cc-glyph--success        { color: var(--color-success, #10B981); }
.cc-glyph--error          { color: var(--color-danger, #EF4444); }
.cc-glyph--reject         { color: var(--color-warning, #D97706); }

/* ────────────────────────────────────────────────────────────────────────
   Thinking collapse
   ──────────────────────────────────────────────────────────────────────── */

.cc-thinking[data-collapsed="true"] .cc-thinking__body { display: none; }
.cc-thinking[data-collapsed="true"] .cc-thinking__summary::after {
  content: " (Ctrl+O to expand)";
  color: var(--color-inactive, #888);
  font-size: 0.85em;
}

.cc-thinking[data-collapsed="false"] .cc-thinking__summary::after {
  content: " (Ctrl+O to collapse)";
  color: var(--color-inactive, #888);
  font-size: 0.85em;
}

/* ────────────────────────────────────────────────────────────────────────
   Error truncation (1000 chars)
   ──────────────────────────────────────────────────────────────────────── */

.cc-error[data-truncated="true"] .cc-error__full { display: none; }
.cc-error[data-truncated="true"] .cc-error__expand-link {
  color: var(--color-info, #3B82F6);
  cursor: pointer;
  text-decoration: underline;
}
.cc-error[data-truncated="false"] .cc-error__preview { display: none; }
.cc-error[data-truncated="false"] .cc-error__expand-link { display: none; }

/* ────────────────────────────────────────────────────────────────────────
   Bash output fold (20 lines)
   ──────────────────────────────────────────────────────────────────────── */

.cc-bash[data-collapsed="true"] .cc-bash__middle { display: none; }
.cc-bash[data-collapsed="false"] .cc-bash__fold-marker { display: none; }
.cc-bash__fold-marker {
  color: var(--color-inactive, #888);
  font-style: italic;
  cursor: pointer;
}
.cc-bash__fold-marker:hover { color: var(--color-info, #3B82F6); }

/* ────────────────────────────────────────────────────────────────────────
   Verbose toggle button (top-right of terminal)
   ──────────────────────────────────────────────────────────────────────── */

.cc-verbose-toggle {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: 1px solid var(--color-inactive, #888);
  color: var(--color-inactive, #888);
  padding: 2px 8px;
  font-size: 0.8em;
  cursor: pointer;
  border-radius: 3px;
  z-index: 5;
}
.cc-verbose-toggle[data-active="true"] {
  border-color: var(--color-info, #3B82F6);
  color: var(--color-info, #3B82F6);
}

/* ════════════════════════════════════════════════════════════════════════
   Welcome v12 — Claude Code 風 logo 動畫 + 3-col feeds
   設計合約：docs/superpowers/specs/2026-05-07-talkstock-terminal-welcome-redesign-design.md
   配色：直接 reference brand-system.css var()，自動跟 light/dark mode 切換。
   Dark mode 實際值：
     --color-info=#60A5FA  --color-success=#34D399
     --color-text-primary=#F5F5F4  --color-text-secondary=#A8A29E
     --color-text-tertiary=#78716C  --color-text-muted=#57534E
     --color-border-default=rgba(255,255,255,0.10)  --color-bg-page=#1C1917
   ════════════════════════════════════════════════════════════════════════ */

/* Frame outer — 圓角邊框包住 banner + 3 col grid.
   定義 local --cc-welcome-blue 給所有 brand accent 統一管理：logo /
   ✻ icon / /command 名 / footer cmd / hover state 全部一致。比 dark
   --color-info (#60A5FA) 亮兩級補足細 stroke 在暗背景的視覺密度。 */
.cc-welcome-v2 {
  --cc-welcome-blue: #93C5FD;

  position: relative;
  border: 1px solid var(--color-border-default);
  border-radius: 8px;
  padding: 18px 16px 14px;
  margin: 8px 0 16px;
  font-family: var(--font-mono, ui-monospace, 'JetBrains Mono', Menlo, monospace);
  font-size: 12px;
  line-height: 1.55;
  color: var(--color-text-primary);
}

/* Frame title 浮在邊框上 (Claude Code 標誌性 ✻ + meta) */
.cc-welcome-v2-title {
  position: absolute;
  top: -0.7em;
  left: 16px;
  background: var(--color-bg-page);
  padding: 0 8px;
  font-size: 12px;
  color: var(--color-text-primary);
  z-index: 1;
}
.cc-welcome-v2-title .accent { color: var(--cc-welcome-blue); }
.cc-welcome-v2-title .meta { color: var(--color-text-secondary); }
.cc-welcome-v2-title .dim  { color: var(--color-text-tertiary); }

/* Logo banner — 含 5 段動畫 */
.cc-welcome-v2-banner {
  position: relative;
  text-align: center;
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: 14px;
  overflow: hidden;
}

/* 外層 wrapper：clip-path typewriter (stage 1) */
.cc-welcome-v2-typer {
  display: inline-block;
  position: relative;
  clip-path: inset(0 100% 0 0);
  animation: cc-w2-typewriter 10s infinite ease-out;
}
@keyframes cc-w2-typewriter {
  0%   { clip-path: inset(0 100% 0 0); }
  18%  { clip-path: inset(0 0 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}

/* Shimmer 偽元素掃光 (stage 2) */
.cc-welcome-v2-typer::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -40%;
  width: 30%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(180, 220, 255, 0.55) 50%,
    transparent 100%);
  pointer-events: none;
  mix-blend-mode: overlay;
  animation: cc-w2-shimmer 10s infinite;
  z-index: 2;
}
@keyframes cc-w2-shimmer {
  0%, 25%   { transform: translateX(0); opacity: 0; }
  27%       { opacity: 1; }
  40%       { transform: translateX(450%); opacity: 1; }
  42%, 100% { opacity: 0; }
}

/* 內層 wrapper：wave + glitch + glow (stage 3-5) */
.cc-welcome-v2-wave {
  display: inline-block;
  animation: cc-w2-wave 10s infinite, cc-w2-glitch 10s infinite, cc-w2-glow 10s infinite;
}
@keyframes cc-w2-wave {
  0%, 40%   { transform: translateY(0); }
  44%       { transform: translateY(-2px); }
  48%       { transform: translateY(0); }
  52%       { transform: translateY(-2px); }
  56%, 100% { transform: translateY(0); }
}
@keyframes cc-w2-glitch {
  0%, 60%   { transform: translate(0); }
  61%       { transform: translate(2px, -1px); }
  62%       { transform: translate(-2px, 1px); }
  63%       { transform: translate(1px, 0); }
  64%       { transform: translate(-1px, 0); }
  65%       { transform: translate(0); }
  72%       { transform: translate(-2px, 1px); }
  73%       { transform: translate(1px, -1px); }
  74%, 100% { transform: translate(0); }
}
@keyframes cc-w2-glow {
  0%, 75%   { text-shadow: 0 0 0.5px currentColor; }
  80%       { text-shadow: 0 0 0.5px currentColor, 0 0 6px rgba(147, 197, 253, 0.6); }
  88%       { text-shadow: 0 0 0.5px currentColor, 0 0 14px #93C5FD, 0 0 28px rgba(147, 197, 253, 0.6); }
  95%       { text-shadow: 0 0 0.5px currentColor, 0 0 6px rgba(147, 197, 253, 0.4); }
  100%      { text-shadow: 0 0 0.5px currentColor; }
}

/* ASCII logo 本體 — 用 --cc-welcome-blue (#93C5FD blue-300) 跟其他
   accent 統一。比 dark --color-info (#60A5FA) 亮兩級補足細 stroke
   視覺密度。 */
.cc-welcome-v2-logo {
  color: var(--cc-welcome-blue);
  font-size: 14px;
  line-height: 1.1;
  margin: 0;
  text-align: left;
  text-shadow: 0 0 0.5px currentColor;
  font-family: inherit;
  white-space: pre;
}

/* Tagline (stage 5 從下淡入) */
.cc-welcome-v2-tagline {
  margin-top: 12px;
  color: var(--color-text-secondary);
  font-size: 12px;
  letter-spacing: 4px;
  text-transform: uppercase;
  opacity: 0;
  animation: cc-w2-tagline 10s infinite;
}
@keyframes cc-w2-tagline {
  0%, 78%   { opacity: 0; transform: translateY(6px); letter-spacing: 8px; }
  85%       { opacity: 1; transform: translateY(0); letter-spacing: 4px; }
  95%       { opacity: 1; }
  100%      { opacity: 0; }
}
.cc-welcome-v2-tagline .dot { color: var(--color-text-tertiary); margin: 0 6px; }

/* 3-col grid */
.cc-welcome-v2-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.1fr;
  gap: 14px;
}
.cc-welcome-v2-col { min-width: 0; }
.cc-welcome-v2-col + .cc-welcome-v2-col {
  padding-left: 14px;
  border-left: 1px solid var(--color-border-subtle);
}
.cc-welcome-v2-col-title {
  color: var(--color-text-primary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

/* Feed item: 50px ts + 1fr text */
.cc-welcome-v2-item {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 8px;
  padding: 1px 0;
  font-size: 12px;
}
.cc-welcome-v2-item .ts {
  color: var(--color-text-secondary);
  font-size: 11px;
  text-align: right;
}
.cc-welcome-v2-item .ts.ok  { color: var(--color-success); }
.cc-welcome-v2-item .ts.tip { color: var(--color-text-tertiary); }
.cc-welcome-v2-item .txt {
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc-welcome-v2-item .txt.is-example {
  cursor: pointer;
}
.cc-welcome-v2-item .txt.is-example:hover { color: var(--cc-welcome-blue); }
.cc-welcome-v2-cmd { color: var(--cc-welcome-blue); }

.cc-welcome-v2-foot {
  color: var(--color-text-secondary);
  font-size: 11px;
  margin-top: 8px;
}
.cc-welcome-v2-foot .cmd { color: var(--cc-welcome-blue); }

/* Agent SSE health chip — 縮成右下角 dot，文字隱藏，靠 className 切色 */
.cc-welcome-v2 .cc-chip {
  position: absolute;
  bottom: 8px;
  right: 12px;
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  text-indent: -9999px;
  background: var(--color-text-tertiary);
  border: none;
  color: transparent;
  font-size: 0;
  line-height: 8px;
}
.cc-welcome-v2 .cc-chip.cc-chip-ok  { background: var(--color-success); }
.cc-welcome-v2 .cc-chip.cc-chip-err { background: var(--color-danger); }

/* prefers-reduced-motion: 拿掉所有動畫，直接定格在最終狀態 */
@media (prefers-reduced-motion: reduce) {
  .cc-welcome-v2-typer,
  .cc-welcome-v2-typer::before,
  .cc-welcome-v2-wave,
  .cc-welcome-v2-tagline {
    animation: none;
  }
  .cc-welcome-v2-typer { clip-path: inset(0 0 0 0); }
  .cc-welcome-v2-tagline { opacity: 1; transform: none; letter-spacing: 4px; }
}

/* 窄容器 fallback (mobile / split view <600px) — 3-col 改 1-col */
@media (max-width: 600px) {
  .cc-welcome-v2-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .cc-welcome-v2-col + .cc-welcome-v2-col {
    padding-left: 0;
    border-left: none;
    padding-top: 14px;
    border-top: 1px solid var(--color-border-subtle);
  }
}
