/* Contact section: chat form + callback form. Mobile-first. */

.contact {
  background: var(--color-paper-2);
  padding-bottom: 80px;
}

.contact-hint {
  font-size: 14px;
  color: var(--color-ink-mute);
  max-width: 520px;
  margin-top: -6px;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 28px;
}

@media (min-width: 900px) {
  .contact-grid {
    grid-template-columns: 1fr 1fr;
    gap: 48px;
  }
}

/* ────── chat ────── */
.chat {
  background: var(--color-ink);
  color: var(--color-paper);
  display: flex;
  flex-direction: column;
  height: 560px;
  max-height: 85vh;
  position: relative;
  overflow: hidden;
}

.chat-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-rule-light);
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-head .dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-circle);
  background: var(--color-ok);
  box-shadow: 0 0 0 4px var(--color-ok-fade);
  flex: none;
}

.chat-head .who {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.chat-head .stat {
  margin-left: auto;
  font-size: 11px;
  color: var(--color-paper-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chat-head-meta {
  font-size: 12px;
  color: var(--color-paper-mute);
}

/* messages */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-rule-light) transparent;
}

.chat-body:focus-visible {
  outline-offset: -2px;
}

.msg {
  max-width: 80%;
  padding: 10px 13px;
  font-size: 14px;
  line-height: 1.45;
  border-radius: var(--radius-xl);
  animation: chat-pop-in 0.3s ease;
  word-break: break-word;
}

.msg.bot {
  background: rgba(245, 241, 234, 0.08);
  border-bottom-left-radius: 3px;
  align-self: flex-start;
}

.msg.bot b {
  color: var(--color-spark-2);
  font-weight: 700;
}

.msg.user {
  background: var(--color-spark);
  color: var(--color-ink);
  border-bottom-right-radius: 3px;
  align-self: flex-end;
  font-weight: 500;
}

.msg.media {
  padding: 6px;
  background: rgba(245, 241, 234, 0.08);
  max-width: 70%;
  align-self: flex-end;
}

.msg.media .preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.msg.media .icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-spark);
  color: var(--color-ink);
  display: grid;
  place-items: center;
  flex: none;
}

.msg.media .icon svg {
  width: 18px;
  height: 18px;
}

.msg.media .meta {
  font-size: 12px;
  color: rgba(245, 241, 234, 0.7);
  line-height: 1.3;
  min-width: 0;
}

.msg.media .meta b {
  display: block;
  color: var(--color-paper);
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.msg .img-thumb {
  display: block;
  width: 100%;
  max-width: 220px;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin: -4px;
}

@keyframes chat-pop-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* quick chips */
.chat-quick {
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--color-rule-light);
}

.chip {
  padding: 10px 16px;
  border: 1px solid var(--color-rule-light);
  font-size: 13px;
  border-radius: var(--radius-pill);
  color: rgba(245, 241, 234, 0.92);
  transition:
    border-color 0.2s,
    color 0.2s,
    background 0.15s;
  background: transparent;
  cursor: pointer;
  min-height: var(--tap-min);
  display: inline-flex;
  align-items: center;
}

.chip:hover,
.chip:focus-visible {
  border-color: var(--color-spark);
  color: var(--color-spark);
}

/* input bar */
.chat-input {
  padding: 12px 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--color-rule-light);
  background: rgba(0, 0, 0, 0.25);
}

.chat-input input[type='text'] {
  flex: 1;
  background: transparent;
  color: var(--color-paper);
  border: 0;
  outline: none;
  font: inherit;
  font-size: 16px;
  padding: 10px 4px;
  min-width: 0;
}

.chat-input input::placeholder {
  color: var(--color-paper-mute);
  opacity: 1;
}

.iconbtn {
  width: var(--tap-min);
  height: var(--tap-min);
  border-radius: var(--radius-circle);
  display: grid;
  place-items: center;
  color: rgba(245, 241, 234, 0.78);
  transition:
    background 0.18s,
    color 0.18s,
    transform 0.18s;
  flex: none;
  position: relative;
  cursor: pointer;
}

.iconbtn:hover,
.iconbtn:focus-visible {
  background: rgba(245, 241, 234, 0.08);
  color: var(--color-paper);
}

.iconbtn.send {
  background: var(--color-spark);
  color: var(--color-ink);
}

.iconbtn.send:hover,
.iconbtn.send:focus-visible {
  background: var(--color-spark-2);
}

.iconbtn.rec {
  color: var(--color-spark-3);
}

.iconbtn.rec.is-recording {
  background: var(--color-spark-3);
  color: var(--color-paper);
  animation: rec-pulse 1.2s ease-in-out infinite;
}

@keyframes rec-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(226, 23, 23, 0.55);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(226, 23, 23, 0);
  }
}

.iconbtn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.iconbtn svg {
  width: 18px;
  height: 18px;
}

/* attachment chip strip (above input bar) */
.attach-strip {
  padding: 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -2px;
  margin-bottom: -2px;
}

.attach-strip:empty {
  display: none;
}

.attach-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 10px;
  background: rgba(245, 241, 234, 0.08);
  border: 1px solid var(--color-rule-light);
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--color-paper);
  max-width: 100%;
}

.attach-pill .name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.attach-pill .size {
  color: var(--color-paper-mute);
  font-size: 11px;
}

.attach-pill button {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-circle);
  background: rgba(245, 241, 234, 0.16);
  color: var(--color-paper);
  display: grid;
  place-items: center;
  transition: background 0.15s;
  position: relative;
  cursor: pointer;
}

/* Expand the touch hitbox to 44px without inflating the pill visually. */
.attach-pill button::before {
  content: '';
  position: absolute;
  inset: -8px;
}

.attach-pill button:hover {
  background: rgba(245, 241, 234, 0.25);
}

.attach-pill button svg {
  width: 12px;
  height: 12px;
}

/* recording indicator */
.rec-banner {
  background: rgba(226, 23, 23, 0.12);
  color: var(--color-spark-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rec-banner[hidden] {
  display: none;
}

.rec-banner .time {
  font-family: var(--font-display);
}

.rec-banner button {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-paper);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.3);
}

.rec-banner button:hover {
  background: rgba(0, 0, 0, 0.5);
}

/* status row inside chat (sending / sent / failed) */
.chat-status {
  font-size: 11px;
  text-align: center;
  padding: 6px 16px 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-paper-mute);
  min-height: 0;
}

.chat-status[data-state='error'] {
  color: var(--color-spark-3);
}

.chat-status[data-state='ok'] {
  color: var(--color-ok);
}

.chat-status:empty {
  display: none;
}

/* ────── callback form ────── */
.callform {
  background: var(--color-paper);
  padding: 24px 22px;
  border: 1px solid var(--color-rule);
}

.callform h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.callform p.intro {
  font-size: 13px;
  color: rgba(11, 11, 12, 0.6);
  margin-bottom: 18px;
}

.field {
  margin-bottom: 12px;
  position: relative;
}

.field label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-ink-mute);
  margin-bottom: 6px;
  font-weight: 500;
}

.field input,
.field textarea {
  width: 100%;
  padding: 12px 0 10px;
  border: 0;
  border-bottom: 1px solid var(--color-rule);
  background: transparent;
  font: inherit;
  /* 16px is the minimum that prevents iOS Safari from auto-zooming on focus. */
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
  color: inherit;
  font-family: inherit;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--color-spark);
}

.field textarea {
  resize: vertical;
  min-height: 64px;
}

.field.is-error input,
.field.is-error textarea {
  border-color: var(--color-spark-3);
}

.field-error {
  font-size: 12px;
  color: var(--color-spark-3);
  margin-top: 6px;
  min-height: 1em;
}

.callform .btn {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.legal {
  font-size: 12px;
  color: var(--color-ink-mute);
  margin-top: 12px;
  text-align: center;
}

.callform.is-success .field,
.callform.is-success .btn,
.callform.is-success p.intro,
.callform.is-success .legal {
  display: none;
}

.callform-success {
  display: none;
  text-align: center;
  padding: 24px 0;
}

.callform.is-success .callform-success {
  display: block;
}

.callform-success-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-circle);
  background: var(--color-spark);
  color: var(--color-ink);
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
}

.callform-success-icon svg {
  width: 24px;
  height: 24px;
}

.callform-success h4 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 6px;
}

.callform-success p {
  font-size: 14px;
  color: var(--color-ink-soft);
  max-width: 280px;
  margin: 0 auto;
}
