/* Demo page + chat widget. Reuses the site's variables from /styles.css. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.demo-hero { padding-top: 48px; padding-bottom: 0; }
.demo-title { font-size: clamp(52px, 7vw, 100px); margin-bottom: 36px; }
.demo-intro { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: start; margin-bottom: 44px; }
.demo-intro .hero-note { margin: 0; }

.demo-stage { padding-top: 64px; }
.demo-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 56px; align-items: start; }
.sample-site { position: relative; }
.sample-flag { display: inline-block; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; background: var(--accent); color: var(--ink); padding: 6px 12px; }
.sample-card { padding: 38px; background: var(--dark); color: var(--paper); }
.sample-card .case-tag { margin-bottom: 14px; }
.sample-card h2 { font-size: clamp(30px, 3.4vw, 46px); margin-bottom: 16px; }
.sample-lede { color: #c4cbbf; font-size: 15px; max-width: 560px; margin-bottom: 28px; }
.try-list { display: flex; flex-wrap: wrap; gap: 10px; }
.try-btn { padding: 10px 14px; border: 1px solid #718069; background: transparent; color: var(--paper); font-size: 13px; text-align: left; transition: background .2s, color .2s; }
.try-btn:hover { background: var(--accent); color: var(--ink); border-color: var(--accent); }

.facts-card { margin-top: 18px; padding: 20px 24px; background: #e9ecdf; border: 1px solid var(--line); }
.facts-card summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.facts-note { font-size: 12px; color: var(--muted); margin: 12px 0 8px; }
.facts-card dl { margin: 0; display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; font-size: 14px; }
.facts-card dt { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: #586b3e; padding-top: 3px; }
.facts-card dd { margin: 0; color: var(--muted); }

.demo-side .how-list { margin: 0 0 24px; padding-left: 20px; }
.demo-side .how-list li { margin-bottom: 12px; color: var(--muted); font-size: 15px; }
.demo-side .how-list strong { color: var(--ink); font-weight: 600; }
.demo-fine { font-size: 12px; color: var(--muted); padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 26px; }

/* ---------- Chat widget ---------- */
.chat-launcher { position: fixed; right: 24px; bottom: 24px; z-index: 40; display: inline-flex; align-items: center; gap: 10px; padding: 14px 20px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(32, 40, 32, .22); }
.chat-launcher:hover { background: #3e5035; }
.chat-launcher-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.chat-launcher-tag { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; background: var(--accent); color: var(--ink); padding: 2px 6px; }
.chat-launcher[aria-expanded="true"] { display: none; }

.chat-panel { position: fixed; right: 24px; bottom: 24px; z-index: 41; width: 390px; height: min(640px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--ink); box-shadow: 0 18px 50px rgba(32, 40, 32, .28); }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: var(--dark); color: var(--paper); }
.chat-title { font-weight: 600; font-size: 15px; line-height: 1.3; }
.chat-badge { display: inline-block; margin-top: 4px; font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; background: var(--accent); color: var(--ink); padding: 2px 7px; }
.chat-head-actions { display: flex; gap: 6px; }
.chat-icon-btn { width: 34px; height: 34px; border: 1px solid #56624e; background: transparent; color: var(--paper); font-size: 18px; line-height: 1; }
.chat-icon-btn:hover { background: #3e5035; }

.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 13px; font-size: 14px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.msg.bot { align-self: flex-start; background: #e9ecdf; border: 1px solid var(--line); }
.msg.user { align-self: flex-end; background: var(--ink); color: var(--paper); }
.msg.note { align-self: stretch; max-width: none; background: transparent; border: 1px dashed #9aa58f; font-size: 12px; color: var(--muted); }
.msg.handoff { border-left: 3px solid #687c35; }
.msg strong { font-weight: 600; }
.typing { align-self: flex-start; font-family: var(--mono); font-size: 12px; color: var(--muted); padding: 4px 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 7px 11px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 600; }
.chip:hover { background: var(--accent); }
.chips.used .chip { opacity: .45; pointer-events: none; }

/* Request form inside the chat. Overrides the site's dark contact-form styles. */
.req-form { align-self: stretch; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: #fff; border: 1px solid var(--line); }
.req-form .req-title { font-weight: 600; font-size: 14px; margin: 0; }
.req-form .req-sub { font-size: 12px; color: var(--muted); margin: -4px 0 2px; }
.req-form label { color: var(--ink); font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.req-form label .opt { font-weight: 400; color: var(--muted); }
.req-form input, .req-form textarea, .req-form select { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 0; background: var(--paper); color: var(--ink); font-size: 14px; font-family: var(--sans); }
.req-form textarea { min-height: 72px; }
.req-form input::placeholder, .req-form textarea::placeholder { color: #8a9285; font-size: 13px; }
.req-form input:focus-visible, .req-form textarea:focus-visible, .req-form select:focus-visible { outline: 2px solid #687c35; outline-offset: 1px; }
.req-form input[type="file"] { padding: 6px; font-size: 12px; }
.req-form .field-err { display: none; font-size: 11px; color: #a3401f; margin-top: 3px; }
.req-form .has-err .field-err { display: block; }
.req-form .has-err input, .req-form .has-err textarea { border-color: #a3401f; }
.req-form .photo-preview { display: none; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.req-form .photo-preview.on { display: flex; }
.req-form .photo-preview img { width: 64px; height: 64px; object-fit: cover; border: 1px solid var(--line); }
.req-form .req-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.req-form .btn-primary { min-height: 40px; padding: 9px 16px; margin: 0; background: var(--ink); color: var(--paper); border-color: var(--ink); min-width: 0; align-self: auto; }
.req-form .btn-primary:hover { background: #3e5035; }
.req-form .btn-secondary { min-height: 40px; padding: 9px 16px; }
.req-form.done { opacity: .6; }
.req-form.done input, .req-form.done textarea, .req-form.done button { pointer-events: none; }

.summary { align-self: stretch; padding: 14px; background: #fff; border: 1px solid var(--ink); font-size: 13px; }
.summary h4 { margin: 0 0 8px; font-size: 14px; }
.summary dl { margin: 0 0 10px; display: grid; grid-template-columns: 92px 1fr; gap: 4px 10px; }
.summary dt { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: #586b3e; padding-top: 3px; }
.summary dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.summary img { width: 72px; height: 72px; object-fit: cover; border: 1px solid var(--line); }
.summary .summary-note { margin: 0; font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }

.chat-input { flex-direction: row; gap: 0; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; padding: 13px 14px; border: 0; background: var(--paper); color: var(--ink); font-size: 15px; }
.chat-input input::placeholder { color: #8a9285; font-size: 14px; }
.chat-input input:focus-visible { outline: 2px solid #687c35; outline-offset: -2px; }
.chat-send { width: 52px; border: 0; background: var(--ink); color: var(--paper); font-size: 18px; }
.chat-send:hover { background: #3e5035; }
.chat-foot { padding: 6px 12px 8px; font-size: 10px; font-family: var(--mono); letter-spacing: .03em; color: var(--muted); text-align: center; }

@media (max-width: 1050px) {
  .demo-grid { grid-template-columns: 1fr; gap: 40px; }
}
@media (max-width: 760px) {
  .demo-hero { padding-top: 34px; }
  .demo-title { font-size: clamp(44px, 12vw, 64px); margin-bottom: 26px; }
  .demo-intro { grid-template-columns: 1fr; gap: 12px; margin-bottom: 30px; }
  .demo-stage { padding-top: 40px; padding-bottom: 96px; }
  .sample-card { padding: 24px; }
  .facts-card dl { grid-template-columns: 1fr; gap: 2px; }
  .facts-card dd { margin-bottom: 8px; }
  .chat-launcher { right: 16px; bottom: 16px; }
  .chat-panel { right: 0; bottom: 0; left: 0; width: 100%; height: 100%; height: 100dvh; border: 0; }
  .chat-input input { font-size: 16px; } /* prevents iOS zoom on focus */
  .req-form input, .req-form textarea { font-size: 16px; }
}

/* On wide screens, keep page content clear of the open chat panel. */
@media (min-width: 1051px) {
  body.chat-open main, body.chat-open footer { margin-right: 420px; }
  body.chat-open .demo-grid { grid-template-columns: 1fr; gap: 40px; }
}
