/* Talk to my portfolio. Uses the site tokens from style.css, so light mode
   (body.light-mode) comes for free. */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.talk-main { padding: clamp(7rem, 12vw, 9rem) 0 var(--space-section); }
.talk-container { max-width: var(--reading-width); }

.talk-head h1 {
  font-family: var(--font-head); font-size: var(--type-section); font-weight: 800;
  line-height: var(--leading-display); letter-spacing: var(--tracking-display);
  margin-bottom: 1.25rem;
}
.talk-head h1 span { color: var(--brand-red); }
.talk-deck { color: var(--text-2); font-size: var(--type-lead); line-height: 1.55; max-width: 38rem; }

.talk-presence {
  display: inline-flex; align-items: center; gap: 0.6rem; margin-top: 1.5rem;
  padding: 0.5rem 0.9rem; border: 1px solid var(--border-2); border-radius: 999px;
  font-size: 0.85rem; color: var(--text-2);
}
.talk-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.talk-presence[data-state="on"] .talk-dot { background: #34C77B; box-shadow: 0 0 0 4px rgba(52, 199, 123, 0.18); }

.talk-card {
  margin-top: 2.5rem; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden;
}
.talk-log {
  display: flex; flex-direction: column; gap: 1rem;
  padding: 1.5rem; min-height: 320px; max-height: min(60vh, 560px); overflow-y: auto;
  scroll-behavior: smooth;
}

.talk-msg { max-width: 85%; }
.talk-who {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 0.35rem;
}
.talk-text {
  white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55;
  padding: 0.8rem 1rem; border-radius: var(--radius-md);
  background: var(--bg-card-2); color: var(--text-primary);
}
.talk-msg-visitor { align-self: flex-end; text-align: right; }
.talk-msg-visitor .talk-text { background: var(--accent-soft); border: 1px solid var(--accent-border); text-align: left; }
/* Michael's own words stand apart from the assistant's. */
.talk-msg-michael .talk-who { color: var(--accent-text); }
.talk-msg-michael .talk-text { background: var(--bg-card-2); border-left: 3px solid var(--brand-red); }
.talk-typing .talk-text { color: var(--text-3); animation: talk-pulse 1.2s ease-in-out infinite; }
@keyframes talk-pulse { 50% { opacity: 0.45; } }

.talk-sources { margin-top: 0.45rem; font-size: 0.8rem; color: var(--text-3); }
.talk-sources a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }

/* Email capture: optional on "Ask Michael", required on "follow up". */
.talk-offer { margin-top: 0.75rem; }
.talk-email { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.6rem; }
.talk-note .talk-email { justify-content: center; }
.talk-email input {
  flex: 1 1 14rem; min-width: 0; min-height: 40px; font: inherit; font-size: 0.9rem;
  color: var(--text-primary); background: var(--bg-card-2);
  border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 0.5rem 0.75rem;
}
.talk-email input:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 1px; }
.talk-email button:disabled { opacity: 0.55; cursor: progress; }
.talk-email-error { flex-basis: 100%; font-size: 0.8rem; color: var(--accent-text); }
.talk-email-error:empty { display: none; }
.talk-offer .talk-hint, .talk-note .talk-hint { display: block; margin-top: 0.45rem; }
.talk-link { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }

.talk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.9rem; margin-top: 0.75rem; }
.talk-hint { font-size: 0.8rem; color: var(--text-3); }

.talk-note {
  align-self: center; text-align: center; max-width: 30rem;
  font-size: 0.88rem; color: var(--text-2);
  padding: 0.75rem 1rem; border: 1px dashed var(--border-2); border-radius: var(--radius-md);
}
.talk-note .talk-actions { justify-content: center; }
.talk-timer { font-variant-numeric: tabular-nums; color: var(--text-3); }

.talk-starters { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0 1.5rem 1rem; }
.talk-starters[hidden] { display: none; }
.talk-chip {
  font: inherit; font-size: 0.85rem; color: var(--text-2); cursor: pointer;
  background: transparent; border: 1px solid var(--border-2); border-radius: 999px;
  padding: 0.45rem 0.9rem; transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.talk-chip:hover, .talk-chip:focus-visible { border-color: var(--brand-red); color: var(--text-primary); }

.talk-form {
  display: flex; gap: 0.75rem; align-items: flex-end;
  padding: 1rem 1.5rem 1.5rem; border-top: 1px solid var(--border);
}
.talk-form textarea {
  flex: 1; resize: none; font: inherit; font-size: 1rem; line-height: 1.5;
  color: var(--text-primary); background: var(--bg-card-2);
  border: 1px solid var(--border-2); border-radius: var(--radius-md);
  padding: 0.75rem 1rem; min-height: 48px;
}
.talk-form textarea:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 1px; }
.talk-send { min-height: 48px; }
.talk-send:disabled { opacity: 0.55; cursor: progress; }

.talk-fine { margin-top: 1rem; font-size: 0.8rem; color: var(--text-3); text-align: center; }

@media (max-width: 600px) {
  .talk-log { padding: 1rem; min-height: 280px; }
  .talk-msg { max-width: 92%; }
  .talk-starters { padding: 0 1rem 0.9rem; }
  .talk-form { padding: 0.9rem 1rem 1rem; gap: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .talk-log { scroll-behavior: auto; }
  .talk-typing .talk-text { animation: none; }
}
