/* Hallmark · component: AEF Claude chat · genre: editorial · theme: AEF grid hybrid · states: 8 · contrast: pending browser check · v2.0.0 */
/* Critique: a calm source-backed work surface, with deliberate Send and clear provider state. */
:root {
  --chat-backdrop: rgb(21 25 24 / 75%);
  --chat-shadow: 0 24px 80px rgb(21 25 24 / 24%);
  --chat-error: #8d2525;
  --chat-focus: var(--cobalt, #244bff);
}
.aef-chat { width: min(640px, calc(100% - 32px)); max-height: 88dvh; padding: clamp(20px, 4vw, 32px); margin: auto; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--paper); color: var(--ink); font-family: var(--body); overflow-y: auto; overscroll-behavior: contain; }
.aef-chat::backdrop { background: var(--chat-backdrop); }
.aef-chat__heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.aef-chat h2 { margin: 0; min-width: 0; font: 800 clamp(28px, 5vw, 40px)/1.1 var(--body); letter-spacing: -0.04em; overflow-wrap: break-word; text-wrap: balance; }
.aef-chat p { font-size: 15px; line-height: 1.6; }
.aef-chat .aef-chat__privacy { padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.aef-chat__messages { max-height: 38dvh; overflow-y: auto; overscroll-behavior: contain; }
.aef-chat__messages:empty { display: none; }
.aef-chat__messages article { margin: 0 0 20px; padding: 0 0 16px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.aef-chat__messages strong { display: block; font: 800 13px/1.5 var(--body); }
.aef-chat__messages p { margin: 8px 0; white-space: pre-wrap; }
.aef-chat__messages blockquote { margin: 12px 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); color: var(--muted); font-size: 14px; line-height: 1.6; }
.aef-chat label { display: block; margin: 20px 0 8px; font: 700 14px/1.5 var(--body); }
.aef-chat textarea { display: block; width: 100%; min-height: 100px; max-height: 240px; resize: vertical; padding: 12px; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--white); color: var(--ink); font: 500 16px/1.5 var(--body); }
.aef-chat textarea::placeholder { color: var(--muted); opacity: 1; }
.aef-chat textarea:read-only { background: var(--soft); }
.aef-chat__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.aef-chat button { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 12px 16px; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: 700 14px/1.4 var(--body); letter-spacing: 0; text-transform: none; cursor: pointer; }
.aef-chat button:hover { background: var(--soft); }
.aef-chat button:active { transform: translateY(1px); }
.aef-chat button:disabled { background: var(--soft); color: var(--muted); border-color: var(--line); cursor: wait; }
.aef-chat .aef-chat__send { background: var(--gold); }
.aef-chat .aef-chat__send:hover { background: var(--gold-light); }
.aef-chat .aef-chat__send:disabled { background: var(--soft); color: var(--muted); border-color: var(--line); }
.aef-chat a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 0; margin-right: 16px; color: var(--ink); font: 700 14px/1.5 var(--body); text-decoration: underline; text-underline-offset: 4px; }
.aef-chat a:hover { color: var(--cobalt); }
.aef-chat a:active { color: var(--ink); }
.aef-chat :is(a, button, textarea):focus-visible { outline: 3px solid var(--chat-focus); outline-offset: 3px; }
.aef-chat .aef-chat__status { margin: 12px 0; color: var(--muted); font-size: 13px; }
.aef-chat[data-chat-state="error"] .aef-chat__status { color: var(--chat-error); }
.aef-chat[data-chat-state="loading"] .aef-chat__status { cursor: progress; }
.aef-chat[data-chat-state="success"] .aef-chat__status { color: var(--ink); }
.aef-chat__footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.aef-chat .aef-chat__note { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.aef-chat [hidden] { display: none; }
.aef-chat-launcher { position: fixed; z-index: 80; right: 18px; bottom: 18px; display: inline-flex; align-items: center; justify-content: center; max-width: 130px; min-width: 112px; min-height: 48px; padding: 12px 16px; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--ink); color: var(--paper); font: 700 14px/1.4 var(--body); letter-spacing: 0; text-transform: none; cursor: pointer; }
.aef-chat-launcher:hover { background: var(--cobalt); }
.aef-chat-launcher:active { transform: translateY(1px); }
.aef-chat-launcher:focus-visible { outline: 3px solid var(--chat-focus); outline-offset: 3px; }
/* The hero already contains Ask AEF; keep its repayment explanation unobscured. */
@media (max-width: 600px) {
  .aef-chat-launcher[data-hero-visible="true"]:not(:focus-visible) { display: none; }
}
.aef-chat-trigger:not(.aef-chat-launcher) { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: 700 14px/1.4 var(--body); letter-spacing: 0; text-transform: none; cursor: pointer; }
.aef-chat-trigger:not(.aef-chat-launcher):hover { background: var(--soft); }
.aef-chat-trigger:not(.aef-chat-launcher):active { transform: translateY(1px); }
.aef-chat-trigger:focus-visible { outline: 3px solid var(--chat-focus); outline-offset: 3px; }
@media (max-width: 980px) { .aef-chat-trigger.header-chat { display: none; } }
@media (max-width: 520px) {
  .aef-chat__messages { max-height: 30dvh; }
  .aef-chat__actions > button { flex: 1; }
  .aef-chat__footer { align-items: flex-start; flex-wrap: wrap; }
}
