/* Fae: Ai-Ki's agent that builds agents.
   One component, used inline on the homepage and full screen on the demo page. */

.fae {
  --fae-ink: #E8EEF7;
  --fae-ink-2: rgba(232, 238, 247, .68);
  --fae-ink-3: rgba(232, 238, 247, .44);
  --fae-line: rgba(232, 238, 247, .12);
  --fae-line-2: rgba(232, 238, 247, .22);
  --fae-signal: #01FFFF;
  --fae-flag: #F5B042;
  --fae-bg: rgba(3, 8, 20, .9);
  --fae-ease: cubic-bezier(.2, .8, .2, 1);
  --fae-ease-io: cubic-bezier(.65, 0, .35, 1);
  --fae-h: 720px;
  --fae-stage: 44%;
  --fae-sans: "Ai-Ki Sans", system-ui, sans-serif;
  --fae-bot: "Ai-Ki Voice", "Ai-Ki Sans", system-ui, sans-serif;

  container: fae / inline-size;
  position: relative;
  height: var(--fae-h);
  color: var(--fae-ink);
  font-family: var(--fae-sans);
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
  background: var(--fae-bg);
  border: 1px solid var(--fae-line);
  border-radius: 28px;
  overflow: hidden;
  isolation: isolate;
}
.fae.is-ready { --fae-stage: 66%; }
.fae *, .fae *::before, .fae *::after { box-sizing: border-box; }
.fae p { margin: 0; }
.fae button { font: inherit; color: inherit; }
.fae :focus-visible { outline: 2px solid var(--fae-signal); outline-offset: 2px; border-radius: 8px; }
.fae-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout: stacked when narrow, side by side when wide ---------- */
.fae-body { position: absolute; inset: 0; display: flex; flex-direction: column; }
.fae-stage { position: relative; order: -1; display: flex; flex-direction: column; flex: 0 0 var(--fae-stage); min-height: 0; border-bottom: 1px solid var(--fae-line); transition: flex-basis .8s var(--fae-ease); }
.fae-talk { position: relative; display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; }
@container fae (min-width: 860px) {
  .fae-body { display: grid; grid-template-columns: minmax(360px, .8fr) minmax(0, 1.2fr); }
  .fae-talk { order: 1; }
  .fae-stage { order: 2; border-bottom: 0; border-left: 1px solid var(--fae-line); }
}

/* ---------- The conversation ---------- */
.fae-thread {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 64px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 64px);
}
.fae-thread::-webkit-scrollbar { display: none; }
.fae-flow { margin-top: auto; display: flex; flex-direction: column; gap: 16px; padding: 64px clamp(18px, 3.2cqi, 32px) 22px; transition: opacity .3s ease; }
@container fae (min-width: 860px) { .fae-flow { padding-inline: clamp(24px, 2.6cqi, 40px); } }
.fae-flow.is-clearing { opacity: 0; }

.fae-say { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 14px; }
.fae-av { position: relative; width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(1, 255, 255, .32); background: #030814; margin-top: 2px; animation: fae-in .5s var(--fae-ease) both; }
.fae-av::after { content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--fae-signal); box-shadow: 0 0 10px var(--fae-signal); }
.fae.is-thinking .fae-say:last-child .fae-av::before { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 1px solid var(--fae-signal); animation: fae-ping 1.4s var(--fae-ease) infinite; }
.fae-lines { display: grid; gap: 8px; }
.fae-line { font-size: clamp(17px, 1.55cqi, 20px); line-height: 1.5; font-weight: 380; letter-spacing: -0.003em; color: var(--fae-ink); text-wrap: pretty; }
.fae-w { display: inline-block; animation: fae-word .5s var(--fae-ease) both; }
.fae-think { display: inline-flex; gap: 5px; align-items: center; height: 1.5em; vertical-align: top; }
.fae-think i { width: 5px; height: 5px; border-radius: 50%; background: var(--fae-ink-2); animation: fae-dot 1.2s ease-in-out infinite; }
.fae-think i:nth-child(2) { animation-delay: .16s; }
.fae-think i:nth-child(3) { animation-delay: .32s; }

.fae-you { align-self: flex-end; max-width: 82%; padding: 10px 16px 11px; border-radius: 18px 18px 6px 18px; background: rgba(232, 238, 247, .1); border: 1px solid var(--fae-line); font-size: 16px; line-height: 1.45; animation: fae-in .45s var(--fae-ease) both; overflow-wrap: anywhere; }

.fae-chips { display: flex; flex-wrap: wrap; gap: 8px; padding-left: 40px; }
.fae-chip {
  padding: 9px 15px 10px;
  border-radius: 999px;
  border: 1px solid var(--fae-line-2);
  background: rgba(232, 238, 247, .03);
  font-size: 15px;
  line-height: 1.2;
  cursor: pointer;
  animation: fae-in .45s var(--fae-ease) both;
  animation-delay: calc(var(--i, 0) * 50ms);
  transition: border-color .2s ease, background-color .2s ease, opacity .2s ease, transform .25s var(--fae-ease);
}
.fae-chip:hover { border-color: rgba(232, 238, 247, .5); background: rgba(232, 238, 247, .07); }
.fae-chip:active { transform: scale(.97); }
.fae-chip.is-other { color: var(--fae-ink-2); border-style: dashed; }
.fae-chips.is-leaving .fae-chip { opacity: 0; transform: scale(.96); pointer-events: none; }
.fae-chips.is-leaving .fae-chip.is-picked { opacity: 1; transform: none; border-color: var(--fae-signal); background: rgba(1, 255, 255, .1); }

.fae-steps { list-style: none; margin: 0; padding: 0 0 0 40px; display: grid; gap: 11px; font-family: var(--fae-bot); font-size: 14.5px; line-height: 1.4; }
.fae-steps li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 12px; color: var(--fae-ink-2); animation: fae-in .45s var(--fae-ease) both; transition: color .4s ease; }
.fae-steps li.is-now { color: var(--fae-ink); }
.fae-mk { width: 16px; height: 16px; margin-top: 1px; }
.fae-mk circle { fill: none; stroke: var(--fae-signal); stroke-width: 1.6; stroke-dasharray: 22 40; transform-origin: 8px 8px; animation: fae-spin .9s linear infinite; }
.fae-mk path { fill: none; stroke: var(--fae-signal); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 14; stroke-dashoffset: 14; }
.fae-steps li.is-done .fae-mk circle { opacity: 0; transition: opacity .2s ease; }
.fae-steps li.is-done .fae-mk path { stroke-dashoffset: 0; transition: stroke-dashoffset .45s var(--fae-ease) .05s; }

.fae-card { margin-left: 40px; padding: 20px 20px 22px; border: 1px solid var(--fae-line); border-radius: 18px; background: rgba(232, 238, 247, .035); animation: fae-in .55s var(--fae-ease) both; }
.fae-card h4 { margin: 0; font-size: 22px; font-weight: 420; font-stretch: 112%; letter-spacing: -0.015em; }
.fae-card > p { margin-top: 6px; font-size: 15px; color: var(--fae-ink-2); }
.fae-card dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 16px; margin: 16px 0 0; font-size: 14px; }
.fae-card dt { font-family: var(--fae-bot); color: var(--fae-ink-3); }
.fae-card dd { margin: 0; }
.fae-card dd.fae-you-rule { color: var(--fae-flag); }
.fae-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-top: 20px; }
.fae-btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 20px; border: 0; border-radius: 12px; background: var(--fae-ink); color: #02040B !important; font-size: 15px; font-weight: 560; font-stretch: 105%; text-decoration: none; cursor: pointer; transition: background-color .2s ease, transform .2s var(--fae-ease), box-shadow .4s ease; }
.fae-btn:hover { background: #fff; }
.fae-btn:active { transform: scale(.98); }
.fae-btn.is-nudged { box-shadow: 0 0 0 6px rgba(1, 255, 255, .18); }
.fae-link { padding: 0; border: 0; background: none; color: var(--fae-ink-2); font-size: 15px; cursor: pointer; text-decoration: underline; text-underline-offset: 5px; text-decoration-color: rgba(232, 238, 247, .3); transition: color .2s ease; }
.fae-link:hover { color: var(--fae-ink); }

.fae-composer { display: flex; gap: 10px; padding: 14px clamp(16px, 2.6cqi, 28px) 18px; border-top: 1px solid var(--fae-line); }
.fae-composer input {
  flex: 1;
  min-width: 0;
  padding: 13px 18px;
  border-radius: 999px;
  border: 1px solid var(--fae-line-2);
  background: rgba(232, 238, 247, .05);
  color: var(--fae-ink);
  font: inherit;
  font-size: 16px;
  transition: border-color .25s ease, background-color .25s ease;
}
.fae-composer input::placeholder { color: var(--fae-ink-3); transition: color .3s ease; }
.fae-composer input:focus { outline: none; border-color: rgba(1, 255, 255, .7); background: rgba(232, 238, 247, .08); }
.fae-send { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--fae-ink); color: #02040B !important; cursor: pointer; transition: opacity .25s ease, transform .25s var(--fae-ease), background-color .2s ease; }
.fae-send:hover { background: #fff; }
.fae-send:active { transform: scale(.94); }
.fae-send[disabled] { opacity: .28; cursor: default; transform: none; }
.fae-send svg { width: 18px; height: 18px; }

/* ---------- The stage: blueprint, then the agent ---------- */
.fae-tabs { position: relative; display: flex; gap: 2px; height: 0; padding: 0 clamp(10px, 2cqi, 22px); opacity: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; border-bottom: 1px solid transparent; transition: height .6s var(--fae-ease), opacity .45s ease .1s, border-color .5s ease; }
.fae.is-ready .fae-tabs { height: 54px; opacity: 1; border-bottom-color: var(--fae-line); }
.fae-tab { position: relative; flex: none; padding: 16px 13px 14px; border: 0; background: none; color: var(--fae-ink-3); font-size: 15px; cursor: pointer; transition: color .25s ease; white-space: nowrap; }
.fae-tab:hover, .fae-tab[aria-selected="true"] { color: var(--fae-ink); }
.fae-ink { position: absolute; left: 0; bottom: -1px; width: 0; height: 2px; border-radius: 2px; background: var(--fae-signal); transition: transform .5s var(--fae-ease), width .5s var(--fae-ease); }
.fae-tabs::-webkit-scrollbar { display: none; }
.fae.has-corner .fae-tabs { padding-right: 140px; }

.fae-views { position: relative; flex: 1; min-height: 0; }
/* Before anyone has said anything, the stage says what it's for */
.fae-note { position: absolute; top: 18px; left: clamp(16px, 2.6cqi, 28px); right: 16px; z-index: 3; margin: 0; font-family: var(--fae-bot); font-size: 13px; line-height: 1.4; color: var(--fae-ink-3); pointer-events: none; transition: opacity .45s ease, transform .6s var(--fae-ease); }
.fae.is-talking .fae-note { opacity: 0; transform: translateY(-4px); }
.fae-view { position: absolute; inset: 0; display: grid; place-items: center; padding: clamp(14px, 2.4cqi, 32px); opacity: 0; visibility: hidden; transform: scale(.985); transition: opacity .45s ease, transform .6s var(--fae-ease), visibility 0s linear .6s; }
.fae-view.is-on { opacity: 1; visibility: visible; transform: none; transition: opacity .55s ease .12s, transform .7s var(--fae-ease) .12s, visibility 0s; }
.fae-view-page, .fae-view-night { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(232, 238, 247, .15) transparent; }

.fae-corner { position: absolute; top: 10px; right: 12px; z-index: 4; opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .5s ease .4s, transform .6s var(--fae-ease) .4s, visibility 0s linear 1s, color .2s ease, border-color .2s ease; display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--fae-line); border-radius: 11px; background: rgba(3, 8, 20, .7); color: var(--fae-ink-2) !important; font-size: 13px; font-family: var(--fae-bot); text-decoration: none; }
.fae.is-ready .fae-corner { opacity: 1; visibility: visible; transform: none; transition: opacity .5s ease .4s, transform .6s var(--fae-ease) .4s, visibility 0s, color .2s ease, border-color .2s ease; }
.fae-corner:hover { color: var(--fae-ink) !important; border-color: var(--fae-line-2); }
.fae-corner svg { width: 14px; height: 14px; }
@container fae (max-width: 520px) {
  .fae-tab { padding-inline: 8px; font-size: 14px; }
  .fae.has-corner .fae-tabs { padding-right: 10px; }
  /* On a phone the inline Fae already fills the screen */
  .fae-corner { display: none; }
}

/* Blueprint */
.fae-orbit { width: 100%; height: 100%; max-width: 660px; max-height: 660px; overflow: visible; }
.fae-orbit text { font-family: var(--fae-bot); font-size: 13px; fill: var(--fae-ink-2); }
.fae-orbit .fae-label { font-size: 14px; fill: var(--fae-ink); }
.fae-orbit .fae-label-you { fill: var(--fae-flag); }
.fae-orbit .fae-core-name { font-family: var(--fae-sans); font-size: 18px; font-weight: 450; fill: var(--fae-ink); }
.fae-orbit .fae-idle-name { font-family: var(--fae-sans); font-size: 16px; font-weight: 500; fill: var(--fae-ink); }
@container fae (max-width: 620px) {
  .fae-orbit text { font-size: 21px; }
  .fae-orbit .fae-label { font-size: 23px; }
  .fae-orbit .fae-core-name { font-size: 26px; }
  .fae-orbit .fae-idle-name { font-size: 24px; }
}
.fae-ring { fill: none; stroke: var(--fae-line); stroke-width: 1; }
.fae-ring-dash { stroke-dasharray: 2 7; }
.fae-spin { transform-origin: 320px 320px; animation: fae-spin 90s linear infinite; }
.fae-dot { transform-box: fill-box; transform-origin: center; animation: fae-breathe 3.8s ease-in-out infinite; }

/* The agent's phone */
.fae-phone { width: min(360px, 100%); height: 100%; max-height: 660px; display: flex; flex-direction: column; border-radius: 34px; border: 1px solid var(--fae-line-2); background: #091021; box-shadow: 0 40px 120px rgba(0, 0, 0, .5), inset 0 0 0 6px #03070F; overflow: hidden; }
.fae-phone-top { display: flex; align-items: center; gap: 12px; padding: 22px 20px 14px; border-bottom: 1px solid var(--fae-line); }
.fae-pic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(1, 255, 255, .45); background: #030814; color: var(--fae-signal); font-weight: 600; font-stretch: 112%; font-size: 15px; }
.fae-phone-top b { display: block; font-weight: 500; font-size: 15px; line-height: 1.3; }
.fae-phone-biz { display: flex; align-items: center; gap: 6px; font-family: var(--fae-bot); font-size: 12px; color: var(--fae-ink-2); }
.fae-phone-biz::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--fae-signal); }
.fae-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.fae-chat::-webkit-scrollbar { display: none; }
.fae-chat-flow { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 16px 14px; }
.fae-bub { max-width: 84%; padding: 9px 13px 10px; border-radius: 18px; font-size: 14.5px; line-height: 1.4; animation: fae-in .4s var(--fae-ease) both; overflow-wrap: anywhere; }
.fae-bub-in { align-self: flex-end; background: var(--fae-ink); color: #0A1122; border-bottom-right-radius: 6px; }
.fae-bub-out { align-self: flex-start; background: rgba(232, 238, 247, .09); border: 1px solid var(--fae-line); border-bottom-left-radius: 6px; }
.fae-typing { align-self: flex-start; display: flex; gap: 4px; padding: 13px 14px; border-radius: 18px; background: rgba(232, 238, 247, .09); animation: fae-in .3s var(--fae-ease) both; }
.fae-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--fae-ink-2); animation: fae-dot 1.1s ease-in-out infinite; }
.fae-typing i:nth-child(2) { animation-delay: .15s; }
.fae-typing i:nth-child(3) { animation-delay: .3s; }
.fae-divider { align-self: center; margin: 10px 0 4px; font-family: var(--fae-bot); font-size: 12px; color: var(--fae-ink-3); animation: fae-in .5s var(--fae-ease) both; }
.fae-phone form { display: flex; gap: 8px; padding: 10px 12px 16px; border-top: 1px solid var(--fae-line); }
.fae-phone input { flex: 1; min-width: 0; padding: 11px 15px; border-radius: 999px; border: 1px solid var(--fae-line-2); background: rgba(232, 238, 247, .05); color: var(--fae-ink); font: inherit; font-size: 14.5px; transition: border-color .25s ease, opacity .3s ease; }
.fae-phone input::placeholder { color: var(--fae-ink-3); }
.fae-phone input:focus { outline: none; border-color: rgba(1, 255, 255, .7); }
.fae-phone input:disabled { opacity: .5; }
.fae-phone .fae-send { width: 40px; height: 40px; }
.fae-phone .fae-send svg { width: 16px; height: 16px; }

/* The page it made */
.fae-browser { width: min(100%, 880px); margin: auto; border-radius: 16px; overflow: hidden; border: 1px solid var(--fae-line-2); background: #F7F8FA; box-shadow: 0 40px 120px rgba(0, 0, 0, .5); }
.fae-browser-top { display: flex; align-items: center; gap: 7px; padding: 11px 14px; background: #0D1526; border-bottom: 1px solid var(--fae-line); }
.fae-browser-top i { width: 10px; height: 10px; border-radius: 50%; background: rgba(232, 238, 247, .18); }
.fae-browser-top span { margin-left: 10px; flex: 1; padding: 5px 12px; border-radius: 8px; background: rgba(232, 238, 247, .06); font-family: var(--fae-bot); font-size: 12.5px; color: var(--fae-ink-2); }
.fae-site { --accent: #2B59C3; position: relative; color: #0E1726; font-family: var(--fae-sans); container: site / inline-size; }
.fae-site-nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 26px; font-size: 14px; }
.fae-site-nav b { font-weight: 650; font-stretch: 110%; font-size: 16px; }
.fae-site-nav span { display: flex; gap: 20px; color: #4A5568; }
.fae-site-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 26px; align-items: end; padding: 32px 26px 36px; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 16%, #F7F8FA), #F7F8FA 70%); }
.fae-site-hero h5 { margin: 0; font-size: clamp(24px, 4.2cqi, 40px); line-height: 1.05; font-weight: 400; font-stretch: 118%; letter-spacing: -0.025em; }
.fae-site-hero p { margin-top: 12px; font-size: 15px; color: #4A5568; max-width: 36ch; }
.fae-site-cta { display: inline-block; margin-top: 18px; padding: 11px 18px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 550; }
.fae-site-art { aspect-ratio: 4 / 3; border-radius: 14px; background: radial-gradient(80% 80% at 30% 20%, color-mix(in srgb, var(--accent) 50%, #fff), var(--accent)); position: relative; overflow: hidden; }
.fae-site-art::after { content: ""; position: absolute; inset: auto -10% -30% -10%; height: 60%; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.fae-site-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 6px 26px 76px; }
.fae-site-items div { padding: 16px; border-radius: 12px; background: #fff; border: 1px solid #E5E8EE; font-size: 14px; font-weight: 500; }
.fae-site-items div::before { content: ""; display: block; width: 26px; height: 3px; margin-bottom: 12px; border-radius: 2px; background: var(--accent); }
.fae-site-chat { position: absolute; right: 16px; bottom: 16px; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 999px; background: #0E1726; color: #fff; font-size: 13px; box-shadow: 0 10px 30px rgba(14, 23, 38, .3); }
.fae-site-chat::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--fae-signal); }
@container site (max-width: 600px) {
  .fae-site-hero { grid-template-columns: minmax(0, 1fr); }
  .fae-site-art, .fae-site-nav span { display: none; }
  .fae-site-items { grid-template-columns: minmax(0, 1fr); padding-bottom: 72px; }
}

/* Its night */
.fae-night { width: min(620px, 100%); margin: auto; }
.fae-night h5 { margin: 0; font-size: clamp(24px, 3.4cqi, 36px); line-height: 1.1; font-weight: 300; font-stretch: 118%; letter-spacing: -0.02em; }
.fae-night > p { margin-top: 10px; color: var(--fae-ink-2); }
.fae-night ol { list-style: none; margin: 26px 0 0; padding: 0; }
.fae-night li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; padding: 15px 0; border-top: 1px solid var(--fae-line); }
.fae-night time { font-family: var(--fae-bot); color: var(--fae-signal); font-variant-numeric: tabular-nums; }
.fae-night .fae-hand { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--fae-line); color: var(--fae-flag); }
.fae-night .fae-hand span:first-child { font-family: var(--fae-bot); }

/* ---------- Motion ---------- */
@keyframes fae-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fae-word { from { opacity: 0; transform: translateY(.18em); filter: blur(3px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes fae-dot { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
@keyframes fae-ping { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.9); opacity: 0; } }
@keyframes fae-spin { to { transform: rotate(360deg); } }
@keyframes fae-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }

@media (prefers-reduced-motion: reduce) {
  .fae *, .fae *::before, .fae *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .fae-spin, .fae-dot { animation: none !important; }
}
