/*
 * Ask Fabrice, set like a transcript in a printed manual: speaker labels in
 * spaced capitals, both sides of the dialogue in the book serif. Colors come
 * from manual.css, so dark mode needs no overrides.
 */

/* The transcript rules do the separating; the title needs no rule */
.ask-fabrice article .title {
  margin-bottom: 1.2rem;
  padding-bottom: 0;
  border-bottom: 0;
}

.ask-fabrice-intro {
  margin: 0 0 2rem;
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.65;
}

/* Transcript */

.ask-fabrice-messages {
  margin: 0 0 1.6rem;
}

.ask-fabrice-messages:empty {
  display: none;
}

.ask-fabrice-message {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  column-gap: 1.2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}

.ask-fabrice-message:first-child {
  border-top: 1.5px solid var(--ink);
}

.ask-fabrice-message:last-child {
  border-bottom: 1.5px solid var(--ink);
}

.ask-fabrice-message::before {
  grid-column: 1;
  grid-row: 1 / span 50;
  padding-top: 0.3rem;
  color: var(--ink-soft);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.6;
  text-transform: uppercase;
}

.ask-fabrice-message-user::before {
  content: "You";
}

.ask-fabrice-message-assistant::before {
  content: "Fabrice";
  color: var(--spot-text);
}

.ask-fabrice-message > * {
  grid-column: 2;
}

.ask-fabrice-message p,
.ask-fabrice-message li {
  margin: 0;
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.65;
}

.ask-fabrice-message p + p,
.ask-fabrice-message p + ul,
.ask-fabrice-message ul + p,
.ask-fabrice-message h3 + p {
  margin-top: 0.7rem;
}

.ask-fabrice-message ul {
  margin: 0.6rem 0 0;
}

.ask-fabrice-message ul li {
  margin: 0.35em 0;
}

.ask-fabrice-message h3 {
  margin: 1rem 0 0.2rem;
  font-size: 1rem;
}

.ask-fabrice-message h3:first-child {
  margin-top: 0;
}

/* Typing indicator: three spot-color dots */

.ask-fabrice-typing {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 1.65rem;
  color: var(--spot);
}

.ask-fabrice-typing span {
  display: inline-block;
  width: 0.36rem;
  height: 0.36rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.25;
  animation: ask-fabrice-twinkle 1.35s ease-in-out infinite;
}

.ask-fabrice-typing span:nth-child(2) {
  animation-delay: 0.18s;
}

.ask-fabrice-typing span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes ask-fabrice-twinkle {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }

  35% {
    opacity: 1;
    transform: translateY(-0.12rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ask-fabrice-typing span {
    animation: none;
    opacity: 0.7;
  }
}

/* Form: a ruled field and an ink button */

.ask-fabrice-form {
  display: grid;
  gap: 0.4rem;
}

/* The transcript rules already separate it from the form */
.ask-fabrice-divider {
  display: none;
}

.ask-fabrice-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
}

.ask-fabrice-form input {
  box-sizing: border-box;
  width: 100%;
  min-height: 3.2rem;
  padding: 0.6rem 0.9rem;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: var(--sheet);
  box-shadow: none;
  color: var(--ink);
  font-family: var(--font-mono);
  /* iOS zooms into fields set smaller than 16px */
  font-size: max(16px, 0.9rem);
}

.ask-fabrice-form input::placeholder {
  color: var(--ink-soft);
  font-style: italic;
  opacity: 1;
}

.ask-fabrice-form input:focus-visible,
.ask-fabrice-form button:focus-visible {
  outline: 2px solid var(--spot);
  outline-offset: 2px;
}

.ask-fabrice-form button {
  min-width: 7rem;
  min-height: 3.2rem;
  padding: 0.4rem 1.4rem;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  box-shadow: none;
  color: var(--sheet);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ask-fabrice-form button:hover:not(:disabled) {
  border-color: var(--spot-text);
  background: var(--spot-text);
}

.ask-fabrice-form button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ask-fabrice-status {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.4;
}

.ask-fabrice-status:empty,
.ask-fabrice-turnstile:empty {
  display: none;
}

.ask-fabrice-turnstile {
  margin-top: 0.25rem;
}

/* Build note: a pointing-hand callout (styles from manual.css) */

.ask-fabrice-build-note {
  margin: 2rem 0 1.4rem;
}

/* Small screens: labels sit above each turn, the button under the field */

@media only screen and (max-width: 520px) {
  .ask-fabrice-message {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.3rem;
  }

  .ask-fabrice-message::before {
    grid-row: auto;
    padding-top: 0;
  }

  .ask-fabrice-message > * {
    grid-column: 1;
  }

  .ask-fabrice-input-row {
    grid-template-columns: 1fr;
  }

  .ask-fabrice-form button {
    width: 100%;
  }
}
