/* The Journey of Truth. Colours carried over from the Typebot's dark theme. */

@font-face {
  font-family: 'Open Sans';
  src: url('/fonts/open-sans-normal.woff2') format('woff2');
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Open Sans';
  src: url('/fonts/open-sans-italic.woff2') format('woff2');
  font-weight: 300 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --page: #1d1d1d;
  --host: #0d0d0d;
  --host-line: #2a2a2a;
  --guest: #2a2a2a;
  --guest-line: #3a3a3a;
  --field-line: #484848;
  --text: #eeeeee;
  --muted: #a3a3a3;
  --accent: #ff5924;
  --accent-bright: #ff7a4d;
  --on-accent: #1a0a04;
  --link: #ff9166;
  --column: 720px;
  --gutter: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* ---- Progress and header ------------------------------------------------ */

.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 4px;
  z-index: 3;
  background: rgba(255, 255, 255, 0.06);
}
.progress__bar {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.6s ease;
}

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-top: 4px;
  background: rgba(29, 29, 29, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--host-line);
}
.top__inner {
  max-width: var(--column);
  margin: 0 auto;
  padding: 10px var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.top__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.top__restart {
  flex: none;
  padding: 6px 12px;
  background: none;
  border: 1px solid var(--field-line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.top__restart:hover {
  color: var(--text);
  border-color: var(--muted);
}

/* ---- Conversation -------------------------------------------------------- */

.chat {
  max-width: var(--column);
  margin: 0 auto;
  padding: 20px var(--gutter) 96px;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  padding-bottom: max(96px, calc(env(safe-area-inset-bottom) + 72px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: calc(100vh - 60px);
  min-height: calc(100dvh - 60px);
}

.chat--instant * {
  animation: none !important;
}

.turn {
  display: flex;
  min-width: 0;
}
.turn--host {
  align-items: flex-end;
  gap: 10px;
}
.turn--guest {
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  padding-left: 42px;
}

.turn__avatar {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  position: sticky;
  bottom: 16px;
}
.turn__bubbles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.bubble {
  max-width: 100%;
  padding: 10px 14px;
  background: var(--host);
  border: 1px solid var(--host-line);
  border-radius: 10px;
  animation: rise 0.25s ease both;
}
.bubble p {
  margin: 0;
}
.bubble p + p {
  margin-top: 0.75em;
}
.bubble a {
  color: var(--link);
  text-underline-offset: 3px;
}
.bubble a:hover {
  color: #ffb294;
}

.bubble--guest {
  background: var(--guest);
  border-color: var(--guest-line);
  white-space: pre-wrap;
}

.bubble--media {
  padding: 8px;
  width: min(440px, 100%);
}
.bubble--media img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: #161616;
}
.bubble--media img[src^='/img/'] {
  aspect-ratio: 1;
}
.bubble--media:has(.video) {
  width: min(560px, 100%);
}

.video {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}
.video iframe,
.video__play {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video__play {
  padding: 0;
  cursor: pointer;
  background: #000 center / cover no-repeat;
}
.video__icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease;
}
.video__icon::after {
  content: '';
  position: absolute;
  left: 26px;
  top: 20px;
  border-style: solid;
  border-width: 12px 0 12px 19px;
  border-color: transparent transparent transparent var(--on-accent);
}
.video__play:hover .video__icon {
  transform: scale(1.08);
}

.bubble__button {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent) !important;
  font-weight: 700;
  text-decoration: none;
}

.bubble--typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px;
}
.bubble--typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.1s infinite ease-in-out;
}
.bubble--typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.bubble--typing span:nth-child(3) {
  animation-delay: 0.3s;
}

/* ---- Answering ------------------------------------------------------------ */

.choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  animation: rise 0.25s ease both;
}
.choice,
.reply__send,
.end__again {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.choice {
  padding: 10px 16px;
  min-height: 44px;
  text-align: left;
}
.choice:hover,
.reply__send:hover,
.end__again:hover {
  background: var(--accent-bright);
}
.choice:active,
.reply__send:active {
  transform: scale(0.98);
}

.reply {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: min(480px, 100%);
  animation: rise 0.25s ease both;
}
.reply[hidden] {
  display: none;
}
.reply__field {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--guest);
  border: 1px solid var(--field-line);
  border-radius: 10px;
  resize: vertical;
}
.reply__field::placeholder {
  color: #9a9a9a;
}
.reply__field:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: transparent;
}
.reply__send {
  flex: none;
  min-height: 44px;
  padding: 10px 16px;
}
.reply__send:disabled {
  opacity: 0.6;
  cursor: default;
}
.reply__mic {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--guest);
  border: 1px solid var(--field-line);
  border-radius: 10px;
  cursor: pointer;
}
.reply__mic:hover {
  border-color: var(--muted);
}
.reply__mic-icon {
  position: relative;
  width: 10px;
  height: 16px;
  border-radius: 5px;
  background: var(--text);
}
.reply__mic-icon::after {
  content: '';
  position: absolute;
  left: -4px;
  top: 6px;
  width: 18px;
  height: 13px;
  border: 2px solid var(--text);
  border-top: 0;
  border-radius: 0 0 9px 9px;
}
.reply__note {
  margin: 0;
  max-width: 480px;
  font-size: 13px;
  color: #ffb294;
  text-align: right;
}
.reply__note:empty {
  display: none;
}

.recording {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(480px, 100%);
  padding: 6px 6px 6px 14px;
  background: var(--guest);
  border: 1px solid var(--field-line);
  border-radius: 10px;
}
.recording__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff3b30;
  animation: blink 1.1s infinite ease-in-out;
}
.recording__time {
  flex: 1;
  font-variant-numeric: tabular-nums;
}
.recording__cancel {
  min-height: 44px;
  padding: 0 10px;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
}
.recording__cancel:hover {
  color: var(--text);
}

.end {
  display: flex;
  justify-content: center;
  padding-top: 18px;
  animation: rise 0.25s ease both;
}
.end__again {
  padding: 10px 18px;
  min-height: 44px;
  background: none;
  border: 1px solid var(--field-line);
  color: var(--text);
  font-weight: 600;
}
.end__again:hover {
  background: var(--guest);
}

.notice,
.noscript {
  max-width: var(--column);
  margin: 40px auto;
  padding: 0 var(--gutter);
  color: var(--muted);
  text-align: center;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .turn--guest {
    padding-left: 0;
  }
  .choices {
    flex-direction: column;
    align-items: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
