/* ask.css - "Ask me" widget for davidmedina.me. Editorial theme: reads the page's :root tokens and fonts. */

.ask {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--text);
  border-radius: 0;
  padding: 36px 40px 28px;
  margin-bottom: 44px;
}
.ask-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 32px; align-items: start; margin-bottom: 24px; }
.ask-title { font-family: 'Newsreader', Georgia, serif; font-size: 34px; font-weight: 500; letter-spacing: -1.2px; line-height: 1.05; }
.ask-sub { font-size: 14px; color: var(--text2); line-height: 1.75; padding-top: 6px; }

.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.ask-chip {
  font: inherit; font-size: 12px; letter-spacing: 0.01em; color: var(--text);
  background: transparent; border: 1px solid var(--border); border-radius: 0;
  padding: 9px 14px; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.ask-chip:hover, .ask-chip:focus-visible { border-color: var(--accent); background: var(--accent-glow); color: var(--accent); outline: none; }
.ask-chips-used .ask-chip { opacity: 0.8; }

.ask-thread { display: flex; flex-direction: column; gap: 14px; max-height: 440px; overflow-y: auto; padding-right: 6px; }
.ask-thread:empty { display: none; }
.ask-msg { padding: 14px 18px; max-width: 92%; border-radius: 0; }
.ask-msg-user { align-self: flex-end; background: var(--bg3); border-right: 3px solid var(--text); }
.ask-msg-me { align-self: flex-start; background: var(--bg); border-left: 3px solid var(--accent); }
.ask-msg-error { border-left-color: var(--orange); }
.ask-msg-who { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text2); margin-bottom: 6px; }
.ask-msg-me .ask-msg-who { color: var(--accent); }
.ask-msg-body { font-size: 15px; line-height: 1.7; color: var(--text); }
.ask-msg-body p { margin: 0 0 8px; }
.ask-msg-body p:last-child { margin-bottom: 0; }

.ask-form { display: flex; gap: 10px; align-items: stretch; margin-top: 20px; border-top: 1px solid var(--border); padding-top: 20px; }
.ask-input {
  flex: 1; font: inherit; font-size: 15px; line-height: 1.5; color: var(--text);
  background: transparent; border: 1px solid var(--text); border-radius: 0;
  padding: 12px 14px; resize: none; min-height: 46px; max-height: 160px;
}
.ask-input::placeholder { color: var(--text2); }
.ask-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.ask-send {
  font: inherit; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: #f8f4eb; background: var(--accent); border: 1px solid var(--accent); border-radius: 0;
  padding: 0 24px; min-height: 46px; cursor: pointer;
}
.ask-send:hover { background: var(--text); border-color: var(--text); }
.ask-send:disabled { opacity: 0.55; cursor: default; }
.ask-send:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ask-status { font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: 0.04em; color: var(--text2); margin-top: 10px; min-height: 14px; }

.ask-dots { display: inline-flex; gap: 5px; align-items: center; height: 20px; }
.ask-dots i { width: 6px; height: 6px; background: var(--accent); animation: ask-bounce 1.2s infinite ease-in-out; }
.ask-dots i:nth-child(2) { animation-delay: 0.15s; }
.ask-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ask-bounce { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.ask-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 900px) {
  .ask { padding: 26px 22px 20px; }
  .ask-head { grid-template-columns: 1fr; gap: 12px; }
  .ask-title { font-size: 28px; }
  .ask-msg { max-width: 100%; }
  .ask-form { flex-direction: column; }
  .ask-send { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .ask-dots i { animation: none; opacity: 0.7; }
}
@media print {
  .ask { display: none; }
}
