.portfolio-chat { color-scheme:dark; --chat-cream:#f1e7d5; --chat-ink:#1d3335; --chat-brass:#d2a567; box-sizing:border-box; width:min(520px,calc(100vw - 28px)); max-height:calc(100dvh - 28px); padding:24px; border:1px solid #d2a56766; border-radius:24px; background:#183134; color:var(--chat-cream); font:400 15px/1.5 'DM Sans',system-ui,sans-serif; box-shadow:0 30px 100px #0009; overscroll-behavior:contain; }
.portfolio-chat::backdrop { background:#050b12c4; }
.portfolio-chat * { box-sizing:border-box; }
.chat-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.chat-eyebrow { margin:0; color:var(--chat-brass); font-size:11px; letter-spacing:.12em; text-transform:uppercase; }
.chat-head h2 { margin:5px 0 20px; color:var(--chat-cream); font:400 42px/1.1 'Cormorant Garamond',Georgia,serif; }
.portfolio-chat button { min-height:44px; border:1px solid #f1e7d544; border-radius:20px; padding:8px 16px; color:inherit; background:transparent; font:inherit; cursor:pointer; }
.portfolio-chat .chat-close { width:44px; padding:0; font-size:26px; border:0; }
.chat-messages { display:flex; flex-direction:column; gap:14px; min-height:90px; max-height:32dvh; overflow:auto; padding:4px 5px 16px 0; scrollbar-width:thin; }
.chat-bubble { margin:0; align-self:flex-start; max-width:94%; padding:13px 17px; border-radius:19px 19px 19px 5px; background:var(--chat-cream); color:var(--chat-ink); white-space:pre-wrap; overflow-wrap:anywhere; }
.chat-you { align-self:flex-end; background:#304c4f; color:var(--chat-cream); border:1px solid #f1e7d533; border-radius:19px 19px 5px 19px; }
.chat-form { display:grid; gap:10px; margin-top:8px; }
.chat-form label { font-size:13px; }
.chat-form textarea { resize:vertical; min-height:76px; max-height:140px; width:100%; padding:12px 14px; border:1px solid #d2a56780; border-radius:14px; background:#102628; color:var(--chat-cream); font:inherit; }
.chat-form textarea::placeholder { color:#b6c4c0; }
.chat-actions { display:flex; justify-content:space-between; gap:14px; }
.portfolio-chat .chat-send { color:var(--chat-ink); background:var(--chat-cream); }
.portfolio-chat button:disabled,.portfolio-chat textarea:disabled { opacity:.5; cursor:not-allowed; }
.chat-status { min-height:21px; margin:12px 0 0; color:var(--chat-cream); font-size:13px; }
.chat-notice { margin:8px 0 0; color:#becbc4; font-size:11px; line-height:1.5; }
.chat-notice a { color:var(--chat-cream); text-decoration:underline; text-underline-offset:3px; }
.portfolio-chat :focus-visible { outline:2px solid var(--chat-brass); outline-offset:3px; }
.chat-open { min-height:44px; padding:10px 19px; border:1px solid #f1e7d566; border-radius:24px; color:#f1e7d5; background:#183134; font:500 14px/1.3 'DM Sans',system-ui,sans-serif; cursor:pointer; }
.site-nav .chat-open { min-height:38px; padding:0 15px; border:1px solid #f5f2eb40; border-radius:999px; background:#050609a8; color:#eee5d5; font:500 13px/1 'DM Sans',system-ui,sans-serif; letter-spacing:.035em; }
@media(max-width:500px) { .portfolio-chat { padding:18px; border-radius:20px; } .chat-head h2 { font-size:36px; } .chat-messages { max-height:30dvh; } .site-nav .chat-open { padding:0 10px; font-size:12px; } }

/* Project pages are the conversation: authored work first, then visitor and AI replies. */
.chat-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; }
.chat-bubble p { margin:0; white-space:pre-wrap; }
.chat-author { display:block; margin-bottom:5px; font-size:11px; font-weight:600; line-height:1.4; opacity:.7; }
.chat-delivery { display:block; margin-top:7px; font-size:10px; opacity:.7; text-align:right; }
.chat-feedback { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.chat-reconnect { flex:none; border:0; padding:8px 0; color:inherit; background:none; font:inherit; font-size:12px; text-decoration:underline; cursor:pointer; }
.chat-typing { display:flex; align-items:center; gap:4px; align-self:flex-start; justify-self:start; padding:15px 18px; border-radius:20px 20px 20px 5px; background:#f1e7d5; color:#1d3335; }
.chat-typing > span { width:4px; height:4px; border-radius:50%; background:currentColor; animation:chat-typing 1.2s ease-in-out infinite; }
.chat-typing > span:nth-child(2) { animation-delay:.15s; }
.chat-typing > span:nth-child(3) { animation-delay:.3s; }
.chat-typing small { margin-left:8px; font-size:12px; }
@keyframes chat-typing { 50% { opacity:.3; transform:translateY(-2px); } }
.project-conversation { --chat-cream:var(--cream); --chat-ink:var(--ink); --chat-brass:var(--brass); overflow-anchor:none; }
.chat-story-label { margin:0 0 -9px 14px; color:#d1d8cd; font-size:10px; letter-spacing:.04em; }
.project-conversation .chat-reset { flex:none; padding:8px 0; border:0; background:none; color:var(--cream); font-size:12px; text-decoration:underline; cursor:pointer; }
.project-conversation .chat-messages { display:grid; gap:14px; width:100%; min-height:0; max-height:none; padding:0; overflow:visible; }
.project-conversation .chat-messages:empty { display:none; }
.project-conversation .chat-bubble { justify-self:start; max-width:min(94%,620px); padding:17px 22px; border-radius:26px 26px 26px 8px; background:var(--bubble); color:var(--ink); font-size:18px; line-height:1.5; box-shadow:var(--lift); scroll-margin-block:160px; }
.project-conversation .chat-you { justify-self:end; background:#1c3838; color:var(--cream); border:1px solid #e4d9c321; border-radius:26px 26px 8px 26px; }
.chat-suggestions { display:flex; flex-wrap:wrap; justify-content:flex-end; justify-self:end; gap:8px; margin:8px 0; }
.chat-suggestions button { padding:10px 15px; min-height:42px; border:1px solid #f1e7d54a; border-radius:18px 18px 5px 18px; background:#1c3838b3; color:var(--cream); font:400 13px/1.4 var(--sans); cursor:pointer; transition:background-color .2s; }
.chat-suggestions button:hover { background:#1c3838; }
.project-chat-dock { position:sticky; bottom:12px; z-index:4; width:100%; padding:10px 10px 7px; margin-top:8px; border:1px solid #f1e7d52b; border-radius:26px; background:#203d3bef; box-shadow:0 12px 40px -14px #071e1f66; backdrop-filter:blur(18px); }
.project-chat-dock .chat-form { gap:8px; margin:0; }
.chat-compose { display:flex; gap:8px; align-items:flex-end; padding:6px 7px 6px 14px; border:1px solid #d2a56759; border-radius:20px; background:#f1e7d5; }
.chat-compose:focus-within { border-color:var(--brass); box-shadow:0 0 0 2px #d2a56733; }
.project-chat-dock textarea { width:100%; min-height:40px; max-height:132px; height:40px; padding:8px 0; border:0; outline:0; border-radius:0; background:none; color:var(--ink); font:400 16px/1.5 var(--sans); resize:none; scrollbar-width:thin; }
.project-chat-dock textarea::placeholder { color:#617471; }
.project-chat-dock .chat-send { flex:none; display:grid; place-items:center; width:40px; height:40px; padding:10px; border:0; border-radius:50%; background:#1d3a38; color:var(--cream); cursor:pointer; }
.chat-send svg { width:21px; height:21px; }
.project-conversation button:disabled { opacity:.4; cursor:not-allowed; }
.project-chat-dock .chat-status { min-height:0; margin:0; font-size:12px; line-height:1.45; color:var(--cream); }
.project-chat-dock .chat-feedback:has(.chat-status:not(:empty)) { padding:0 7px 9px; }
.project-chat-dock .chat-notice { margin:5px 3px 0; text-align:center; font-size:10px; color:#cbd4c8; }
.project-chat-dock .chat-check { overflow:hidden; padding:3px; }
.project-conversation .end { margin-top:8px; }
@media(max-width:699px),(max-aspect-ratio:5/4) {
  .project-conversation .chat-bubble { padding:15px 18px; font-size:17px; }
  .project-chat-dock { bottom:max(8px,env(safe-area-inset-bottom)); padding:8px 8px 6px; border-radius:24px; }
  .project-conversation .chat-author { font-size:10px; }
  .project-conversation .chat-notice { font-size:9px; }
  .project-page:has([data-project-chat]) .room-motion-toggle { position:absolute; bottom:auto; top:60px; }
}
@media(prefers-reduced-motion:reduce) { .chat-typing > span { animation:none; } }
/* How messages are handled, said here: the site has no privacy page (src/chat/disclosure.ts). */
.chat-privacy { margin:4px 0 0; color:#becbc4; font-size:11px; line-height:1.5; }
.chat-privacy summary { display:inline-block; cursor:pointer; color:var(--chat-cream); text-decoration:underline; text-underline-offset:3px; list-style:none; }
.chat-privacy summary::-webkit-details-marker { display:none; }
.chat-privacy p { margin:6px 0 0; text-align:left; }
.chat-privacy a { color:var(--chat-cream); }
.project-chat-dock .chat-privacy { text-align:center; font-size:10px; color:#cbd4c8; }
@media (pointer:coarse) {
  .chat-form textarea { font-size:16px; }
  .site-nav .chat-open,.chat-suggestions button,.chat-reconnect,.project-conversation .chat-reset { min-height:44px; }
  .project-chat-dock .chat-send { width:44px; height:44px; }
  .chat-privacy summary { min-height:44px; padding:12px 2px; }
  .project-page:has([data-project-chat]) .room-motion-toggle { top:calc(64px + env(safe-area-inset-top)); }
  .project-chat-dock { bottom:max(8px,env(safe-area-inset-bottom)); }
}

.chat-form[aria-busy="true"] .chat-send { animation:chat-wait 1.2s ease-in-out infinite; }
@keyframes chat-wait { 50% { opacity:.4; } }
@media (prefers-reduced-motion:reduce) { .chat-form[aria-busy="true"] .chat-send { animation:none; } }
