/**
 * Homepage prompt intro — uses tokens from assets/design-tokens.css
 */

.intro-chat {
  --intro-surface: var(--bg-off);
  --intro-border: var(--border);
  --intro-muted: var(--mid);
  --intro-soft: var(--light);

  position: relative;
  min-height: max(min(88vh, 760px), 520px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--space-12) + var(--space-10)) var(--page-inline) calc(var(--space-10) + var(--space-11));
  background: var(--intro-surface);
  border-bottom: 1px solid var(--intro-border);
  transition: min-height 0.45s ease, padding 0.35s ease, opacity 0.35s ease;
}

.intro-chat__inner {
  width: 100%;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
}

.intro-chat__eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--label-caps);
  text-align: center;
}

.intro-chat__headline {
  text-align: center;
  font-size: clamp(22px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.18;
  color: var(--heading-on-light);
  margin: 0;
  max-width: 22em;
}

.intro-chat__panel {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--intro-border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.intro-chat__panel.is-focused {
  border-color: rgba(89, 255, 201, 0.45);
  box-shadow: 0 4px 28px rgba(89, 255, 201, 0.12);
}

.intro-chat__body {
  padding: var(--space-4) var(--space-5) var(--space-3);
  min-height: 46px;
}

.intro-chat__ph-layer {
  position: relative;
  min-height: 26px;
}

.intro-chat__ph {
  position: absolute;
  inset: 0;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--intro-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.25s;
}

.intro-chat__ph.is-active {
  opacity: 1;
}

.intro-chat__typed {
  position: absolute;
  inset: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--heading-on-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
}

.intro-chat__typed.is-visible {
  opacity: 1;
}

.intro-chat__cursor {
  display: inline-block;
  width: 2px;
  height: 15px;
  background: var(--heading-on-light);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: intro-chat-blink 0.85s step-end infinite;
}

.intro-chat__cursor--accent {
  background: var(--accent-ink);
}

@keyframes intro-chat-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.intro-chat__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3) var(--space-3);
  gap: var(--space-3);
}

.intro-chat__toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.intro-chat__tool-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--intro-border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--intro-muted);
  flex-shrink: 0;
  cursor: default;
}

.intro-chat__chips {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.intro-chat__chips.is-visible {
  display: flex;
}

.intro-chat__chip {
  border: 1.5px solid var(--intro-border);
  background: var(--intro-surface);
  border-radius: 999px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--body-text);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}

.intro-chat__chip:hover {
  border-color: var(--accent-soft);
}

.intro-chat__chip.is-active {
  border-color: var(--accent-ink);
  background: rgba(89, 255, 201, 0.12);
}

.intro-chat__send {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--hairline);
  color: var(--heading-on-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: default;
  transition: background 0.2s, transform 0.15s;
}

.intro-chat__send.is-enabled {
  background: var(--accent-ink);
  color: var(--btn-primary-fg);
  cursor: pointer;
}

.intro-chat__send.is-enabled svg path {
  stroke: var(--btn-primary-fg);
}

.intro-chat__thinking {
  display: none;
  gap: 4px;
  align-items: center;
}

.intro-chat__thinking.is-visible {
  display: flex;
}

.intro-chat__thinking span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-soft);
  animation: intro-chat-dot 1.1s ease-in-out infinite;
}

.intro-chat__thinking span:nth-child(2) {
  animation-delay: 0.15s;
}

.intro-chat__thinking span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes intro-chat-dot {
  0%,
  80%,
  100% {
    transform: scale(0.65);
    opacity: 0.35;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.intro-chat__skip {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--intro-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-2);
  opacity: 0.5;
  transition: opacity 0.3s, color 0.15s;
}

.intro-chat__skip.is-visible {
  opacity: 1;
}

.intro-chat__skip:hover {
  color: var(--heading-on-light);
}

.intro-chat__response {
  width: 100%;
  text-align: left;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.intro-chat__response.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.intro-chat__response-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.intro-chat__avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.intro-chat__avatar svg {
  width: 11px;
  height: 11px;
  fill: var(--btn-primary-fg);
}

.intro-chat__source {
  font-size: 12px;
  font-weight: 600;
  color: var(--intro-muted);
}

.intro-chat__answer {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.75;
  color: var(--body-text);
  letter-spacing: -0.01em;
}

.intro-chat__answer .hl {
  font-weight: 600;
  color: var(--heading-on-light);
}

.intro-chat__answer .acc {
  font-weight: 600;
  color: var(--accent-ink);
}

.intro-chat__cta-row {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.intro-chat__cta-row.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.intro-chat__cta-row .btn-primary {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  padding: var(--space-2) var(--space-5);
  gap: 6px;
  border-radius: 7px;
  box-shadow: 0 2px 10px rgba(123, 164, 150, 0.28);
}

.intro-chat__cta-row .btn-primary:hover {
  box-shadow: 0 4px 16px rgba(123, 164, 150, 0.34);
}

.intro-chat__cta-row .btn-primary svg {
  width: 12px;
  height: 12px;
}

.intro-chat__scroll-hint {
  position: absolute;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

.intro-chat__scroll-hint.is-visible {
  opacity: 0.85;
}

.intro-chat__scroll-hint span {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--intro-muted);
}

.intro-chat__scroll-line {
  width: 1px;
  height: 18px;
  background: linear-gradient(to bottom, var(--intro-muted), transparent);
}

/* Collapsed / dismissed */
.intro-chat.intro-chat--dismissed {
  position: sticky;
  top: var(--space-12);
  z-index: 90;
  min-height: 0;
  padding: var(--space-2) var(--page-inline);
  flex-direction: row;
  justify-content: center;
  align-items: center;
}

.intro-chat.intro-chat--dismissed .intro-chat__inner {
  max-width: none;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
}

.intro-chat.intro-chat--dismissed .intro-chat__eyebrow,
.intro-chat.intro-chat--dismissed .intro-chat__headline,
.intro-chat.intro-chat--dismissed .intro-chat__panel,
.intro-chat.intro-chat--dismissed .intro-chat__skip,
.intro-chat.intro-chat--dismissed .intro-chat__thinking,
.intro-chat.intro-chat--dismissed .intro-chat__response,
.intro-chat.intro-chat--dismissed .intro-chat__cta-row,
.intro-chat.intro-chat--dismissed .intro-chat__scroll-hint {
  display: none !important;
}

.intro-chat__collapsed-bar {
  display: none;
  align-items: center;
  gap: var(--space-4);
  font-size: 13px;
  color: var(--intro-muted);
}

.intro-chat.intro-chat--dismissed .intro-chat__collapsed-bar {
  display: flex;
}

.intro-chat__replay {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--intro-border);
  background: var(--bg);
  color: var(--heading-on-light);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.intro-chat__replay:hover {
  border-color: var(--accent-soft);
}

/* Reduced motion: static fallback */
html.intro-chat--reduced .intro-chat {
  min-height: auto;
  padding: var(--space-10) var(--page-inline);
}

html.intro-chat--reduced .intro-chat__panel,
html.intro-chat--reduced .intro-chat__thinking,
html.intro-chat--reduced .intro-chat__scroll-hint,
html.intro-chat--reduced .intro-chat__skip {
  display: none !important;
}

html.intro-chat--reduced .intro-chat__response,
html.intro-chat--reduced .intro-chat__cta-row {
  opacity: 1 !important;
  transform: none !important;
}

html.intro-chat--reduced .intro-chat__inner {
  gap: var(--space-4);
}

@media (max-width: 600px) {
  .intro-chat {
    min-height: auto;
    padding-top: calc(var(--space-12) + var(--space-8));
  }

  .intro-chat__headline {
    font-size: clamp(20px, 5.2vw, 28px);
  }

  .intro-chat__ph,
  .intro-chat__typed {
    white-space: normal;
    position: relative;
  }

  .intro-chat__cta-row {
    justify-content: center;
  }
}
