/* Ember in public — the homepage entry and the Talk to Ember panel
 * (forgeos-ember-public.js; the face is forgeos-guide's).
 *
 * The site is navy and indigo; Ember is the one warm thing on it. The warmth
 * is spent in two places only -- the face, and a thin ember edge on what
 * Ember says -- so the panel still reads as part of the site. Day surfaces
 * come from the platform tokens, so light, dark and the theme toggle all hold.
 * No inline styles: the page is served under style-src 'self'. */

:root {
  --ember-flame: #ff6a1f;
  --ember-core: #ffb547;
  --ember-edge: color-mix(in srgb, var(--ember-flame) 55%, transparent);
  --ember-wash: color-mix(in srgb, var(--ember-core) 12%, var(--surface));
}

/* ── The entry under the homepage box ────────────────────────────────── */
.ember-entry { display: flex; justify-content: center; margin-top: 22px; }
.ember-entry[hidden] { display: none; }
.ember-entry-btn {
  display: inline-flex; align-items: center; gap: 12px; max-width: 34rem; min-height: 56px;
  padding: 8px 18px 8px 8px; border-radius: var(--r-pill); text-align: left; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.ember-entry-btn:hover { border-color: var(--ember-edge); box-shadow: 0 10px 28px -16px var(--ember-flame); }
.ember-entry-btn:focus-visible { outline: 3px solid var(--indigo-300); outline-offset: 2px; }
.ember-entry-btn[aria-expanded="true"] { border-color: var(--ember-edge); }
.ember-entry-face { flex: none; width: 40px; height: 40px; }
.ember-entry-words { display: grid; gap: 1px; }
.ember-entry-words b { font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
.ember-entry-words span { font-size: 13px; color: var(--ink-3); line-height: 1.35; }

/* ── The panel: a sheet at the side, never over the box you type in ──── */
.ember-panel {
  position: fixed; z-index: 60; right: 24px; bottom: 24px; width: min(420px, calc(100vw - 48px));
  height: min(660px, calc(100vh - 120px)); display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 24px; box-shadow: var(--e-3); overflow: hidden;
}
.ember-panel[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .ember-panel:not([hidden]) { animation: ep-rise .26s var(--ease) both; }
}
@keyframes ep-rise { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.ep-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px 16px;
  border-bottom: 1px solid var(--line);
  background: radial-gradient(120% 140% at 0% 0%, var(--ember-wash), var(--surface) 60%);
}
.ep-face { flex: none; width: 44px; height: 44px; }
.ep-who { flex: 1; min-width: 0; }
.ep-who h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.ep-who p { margin: 1px 0 0; font-size: 12.5px; line-height: 1.35; color: var(--ink-3); }
.ep-close {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-2); cursor: pointer;
}
.ep-close:hover { background: var(--surface-2); }
.ep-close svg { width: 20px; height: 20px; }
.ep-close:focus-visible, .ep-mic:focus-visible, .ep-send:focus-visible, .ep-voice:focus-visible,
.ep-handoff:focus-visible { outline: 3px solid var(--indigo-300); outline-offset: 2px; }

.ep-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.ep-line p { margin: 0; font-size: 15px; line-height: 1.5; }
.ep-ember { max-width: 92%; padding: 10px 14px; border-radius: 4px 18px 18px 18px; background: var(--surface-2);
  box-shadow: inset 2px 0 0 var(--ember-edge); }
.ep-you { align-self: flex-end; max-width: 82%; padding: 10px 14px; border-radius: 18px 18px 4px 18px;
  background: var(--tint-050); color: var(--tint-ink); }
.ep-break { box-shadow: inset 2px 0 0 var(--line-2); color: var(--ink-2); }
.ep-starters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ep-starters .chip { height: auto; min-height: 36px; padding: 6px 12px; white-space: normal; text-align: left; cursor: pointer; font: inherit; font-size: 13px; }
.ep-starters .chip:hover { border-color: var(--ember-edge); color: var(--ink); }

.ep-examples { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.ep-example { margin: 0; }
.ep-example a { display: block; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.ep-example a:hover { border-color: var(--ember-edge); }
.ep-example img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.ep-example figcaption { padding: 7px 9px 8px; font-size: 12.5px; line-height: 1.35; color: var(--ink-2); }

.ep-handoff {
  margin: 0 16px 10px; display: grid; gap: 2px; padding: 10px 16px; border: 0; border-radius: 16px; cursor: pointer;
  text-align: left; font: inherit; background: var(--indigo-600); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 10px 26px -12px rgba(79,70,229,.9);
}
.ep-handoff[hidden] { display: none; }
.ep-handoff:hover { background: var(--indigo-500); }
.ep-handoff-go { font-weight: 650; font-size: 15px; }
.ep-handoff-idea { font-size: 13px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ep-form { display: flex; align-items: flex-end; gap: 8px; margin: 0 12px; padding: 8px 8px 8px 14px;
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.ep-form:focus-within { border-color: var(--indigo-400); box-shadow: 0 0 0 4px var(--tint-050); }
.ep-form[aria-busy="true"] .ep-send { opacity: .5; }
.ep-field { flex: 1; min-width: 0; min-height: 44px; max-height: 30vh; resize: none; border: 0; outline: 0; padding: 10px 0;
  background: transparent; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.4; }
.ep-field::placeholder { color: var(--ink-3); }
/* The form's own ring shows focus; a second ring inside it is noise. */
.ep-field:focus-visible { outline: 0; box-shadow: none; }
.ep-actions { display: flex; gap: 6px; }
.ep-mic, .ep-send { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; border: 0; }
.ep-mic { background: var(--surface-2); color: var(--ink-2); }
.ep-mic[hidden] { display: none; }
.ep-mic[aria-pressed="true"] { background: var(--ember-flame); color: #fff; box-shadow: 0 0 0 6px color-mix(in srgb, var(--ember-flame) 22%, transparent); }
.ep-send { background: var(--indigo-600); color: #fff; }
.ep-send:hover { background: var(--indigo-500); }
.ep-mic svg, .ep-send svg { width: 20px; height: 20px; }

.ep-foot { display: flex; align-items: center; gap: 10px; padding: 8px 16px 12px; }
.ep-voice { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: transparent; color: var(--ink-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.ep-voice[hidden] { display: none; }
.ep-voice[aria-pressed="true"] { border-color: var(--ember-edge); color: var(--ink); }
.ep-voice svg { width: 16px; height: 16px; }
.ep-note { margin: 0; font-size: 11.5px; line-height: 1.35; color: var(--ink-3); }
.ep-note a { text-decoration: underline; text-underline-offset: 2px; }

/* On a phone the panel is a sheet from the bottom edge. */
@media (max-width: 640px) {
  .ember-entry-btn { width: 100%; }
  .ember-panel { left: 0; right: 0; bottom: 0; width: 100%; height: min(88vh, 100dvh - 40px); border-radius: 22px 22px 0 0; border-bottom: 0; }
  .ep-foot { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
