/* =====================================================================
   Page "Terrain commun" — chat Alfred style Telegram
   ===================================================================== */

.tc-page main {
  background: linear-gradient(180deg, var(--surface-container-low) 0%, var(--surface) 60%);
  min-height: calc(100vh - 80px);
}

/* ── Hero en deux colonnes ────────────────────────────────────────── */
.tc-hero {
  padding: 64px 24px 32px;
}
.tc-hero__inner {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 48px;
  align-items: center;
}
.tc-hero h1 {
  font-family: var(--font-voice);
  font-size: clamp(2rem, 4.2vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 16px 0 20px;
}
.tc-lede {
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--on-surface);
  margin-bottom: 24px;
}
.tc-features {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  gap: 10px;
  font-size: 0.98rem;
}
.tc-features li {
  position: relative;
  padding-left: 24px;
  color: var(--on-surface);
  line-height: 1.5;
}
.tc-features li::before {
  content: "◆";
  position: absolute;
  left: 0; top: 2px;
  color: var(--tertiary, #486272);
  font-size: 0.8em;
}
.tc-hero__img {
  margin: 0;
  text-align: center;
}
.tc-hero__img img {
  width: 100%;
  max-width: 320px;
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.08));
}
.tc-hero__img figcaption {
  font-family: var(--font-structure);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  margin-top: 8px;
}

/* ── Chat ─────────────────────────────────────────────────────────── */
.tc-chat-section {
  padding: 24px 16px 40px;
}
.tc-chat-wrap {
  max-width: 860px;
  margin: 0 auto;
}
.tc-chat {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  display: flex;
  flex-direction: column;
  min-height: 500px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
}
.tc-chat__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface-container);
  border-bottom: 1px solid var(--outline-variant);
}
.tc-chat__avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 44px;
  background-image: url('/assets/img/alfred-watercolor.png');
  background-size: 119%;
  background-position: 52% 0%;
  background-repeat: no-repeat;
  background-color: #d9e4e8;
}
.tc-chat__avatar img { display: none; }
.tc-chat__meta { flex: 1; min-width: 0; }
.tc-chat__name {
  font-family: var(--font-voice);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--on-surface);
}
.tc-chat__status {
  font-size: 0.78rem;
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tc-chat__status::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #3aa55c;
  display: inline-block;
}

/* ── Messages — bulles Telegram ─────────────────────────────────── */
.tc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  background:
    radial-gradient(circle at 20% 10%, rgba(72, 98, 114, 0.04), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(120, 140, 100, 0.04), transparent 40%),
    var(--surface);
  max-height: 60vh;
  scroll-behavior: smooth;
}
.tc-msg {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  animation: tc-bubble-in 260ms ease-out;
}
.tc-msg--user {
  flex-direction: row-reverse;
}
.tc-msg__avatar {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-structure);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--on-surface);
  border: 1px solid var(--outline-variant);
}
.tc-msg--alfred .tc-msg__avatar {
  background-image: url('/assets/img/alfred-watercolor.png');
  background-size: 119%;
  background-position: 52% 0%;
  background-color: #d9e4e8;
}
.tc-msg--user .tc-msg__avatar {
  background: var(--tertiary, #486272);
  color: var(--surface);
  border: 0;
}
.tc-msg__body {
  max-width: 72%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tc-msg--user .tc-msg__body { align-items: flex-end; }
.tc-msg__name {
  font-family: var(--font-structure);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--on-surface-variant);
  margin: 0 10px;
}
.tc-msg__bubble {
  padding: 10px 14px;
  font-size: 0.98rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  border-radius: 18px;
}
.tc-msg--alfred .tc-msg__bubble {
  background: var(--surface-container-high);
  color: var(--on-surface);
  border-bottom-left-radius: 4px;
}
.tc-msg--user .tc-msg__bubble {
  background: var(--tertiary, #486272);
  color: var(--surface);
  border-bottom-right-radius: 4px;
}

@keyframes tc-bubble-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Status + typing ─────────────────────────────────────────────── */
.tc-status {
  padding: 4px 18px 0;
  font-size: 0.82rem;
  color: var(--on-surface-variant);
  min-height: 18px;
  font-style: italic;
}

/* ── Input ───────────────────────────────────────────────────────── */
.tc-input {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border-top: 1px solid var(--outline-variant);
}
.tc-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--outline-variant);
  border-radius: 22px;
  padding: 10px 16px;
  font-family: var(--font-structure);
  font-size: 1rem;
  background: var(--surface);
  min-height: 44px;
  max-height: 180px;
  line-height: 1.4;
  transition: border-color 180ms;
}
.tc-input textarea:focus {
  outline: none;
  border-color: var(--tertiary, #486272);
}
.tc-input button {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--tertiary, #486272);
  color: var(--surface);
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms, transform 140ms;
}
.tc-input button:hover:not(:disabled) {
  background: #3a4f5c;
  transform: scale(1.06);
}
.tc-input button:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* ── Actions ─────────────────────────────────────────────────────── */
.tc-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 20px;
}
.tc-btn {
  font-family: var(--font-structure);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 22px;
  border: 1px solid var(--outline-variant);
  background: var(--surface);
  color: var(--on-surface);
  cursor: pointer;
  transition: background 180ms, transform 140ms;
}
.tc-btn:hover:not(:disabled) {
  background: var(--surface-container);
  transform: translateY(-1px);
}
.tc-btn--primary {
  background: var(--primary);
  color: var(--surface);
  border: 0;
}
.tc-btn--primary:hover:not(:disabled) {
  background: var(--primary-dim, #3f3f3f);
}
.tc-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Error bubble ────────────────────────────────────────────────── */
.tc-error {
  background: #fdecea;
  border-left: 3px solid #c62828;
  padding: 14px 18px;
  margin: 14px 0;
  color: #8b2525;
  font-size: 0.92rem;
  line-height: 1.5;
  border-radius: 0 8px 8px 0;
}
.tc-error a { color: #8b2525; text-decoration: underline; }
.tc-error code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.85em;
}

/* ── Section rassurance ──────────────────────────────────────────── */
.tc-reassure {
  padding: 40px 24px 80px;
  background: var(--surface-container-low);
}
.tc-reassure__inner {
  max-width: 720px;
  margin: 0 auto;
}
.tc-reassure h2 {
  font-family: var(--font-voice);
  font-size: 1.75rem;
  margin-bottom: 16px;
}
.tc-reassure p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--on-surface);
  margin-bottom: 14px;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .tc-hero__inner {
    grid-template-columns: 1fr;
    gap: 28px;
    text-align: left;
  }
  .tc-hero__img { order: -1; max-width: 200px; margin: 0 auto; }
  .tc-msg__body { max-width: 80%; }
}
@media (max-width: 520px) {
  .tc-hero { padding: 32px 16px 20px; }
  .tc-chat-section { padding: 16px 8px 32px; }
  .tc-messages { padding: 14px 10px; max-height: 56vh; }
  .tc-msg__body { max-width: 82%; }
  .tc-msg__bubble { font-size: 0.94rem; padding: 9px 12px; }
  .tc-input { padding: 10px; }
  .tc-actions { justify-content: stretch; }
  .tc-actions .tc-btn { flex: 1; text-align: center; padding: 14px; }
}
