/* Mucho Mate — drinkmucho.com · one page: say hola to Mateo */

@font-face {
  font-family: "Kapra";
  src: url("fonts/Kapra-Bold.otf") format("opentype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --pink: #F3B3B1;        /* matches the product photo background */
  --pink-deep: #E9A3A1;
  --coral: #E97B77;
  --ink: #294422;          /* Mateo's outline green */
  --green: #2C5A2C;        /* can green */
  --white: #FFFFFF;
  --display: "Kapra", "Arial Narrow", sans-serif;
  --body: "Archivo", system-ui, -apple-system, sans-serif;
  --col: 520px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--pink);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.45;
}
img { display: block; max-width: 100%; height: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -9999px; }

/* top */
.top {
  display: flex;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 16px 0;
}
.wordmark { width: 128px; }

/* conversation */
.chat {
  flex: 1;
  width: 100%;
  max-width: var(--col);
  margin: 0 auto;
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.mateo { display: flex; justify-content: center; margin: 8px 0 18px; }
.mateo img { width: 170px; } /* white body, black outline, transparent around him */

.thread {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bubble {
  max-width: 84%;
  padding: 11px 16px 12px;
  border-radius: 22px;
  animation: pop 0.28s cubic-bezier(.2, .9, .3, 1.2) both;
  overflow-wrap: anywhere;
  scroll-margin-bottom: 110px; /* clear the sticky composer */
}
.from-mateo {
  align-self: flex-start;
  background: var(--white);
  border-bottom-left-radius: 6px;
}
.from-mateo + .from-mateo { border-top-left-radius: 6px; }
.from-you {
  align-self: flex-end;
  background: var(--ink);
  color: var(--white);
  border-bottom-right-radius: 6px;
  white-space: pre-wrap;
}
.who {
  display: block;
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--coral);
  margin-bottom: 2px;
}
.typing { display: inline-flex; gap: 5px; padding: 16px 18px; }
.typing i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink); opacity: 0.35;
  animation: blink 1s infinite;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }

/* stagger the opening lines */
.thread > .bubble:nth-child(2) { animation-delay: 0.35s; }
.thread > .bubble:nth-child(3) { animation-delay: 0.7s; }

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes blink { 50% { opacity: 0.9; } }

/* composer */
.composer {
  position: sticky;
  bottom: 0;
  width: 100%;
  max-width: var(--col);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: linear-gradient(to bottom, rgba(243, 179, 177, 0), var(--pink) 30%);
}
.field { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.composer textarea,
.composer input[type="email"] {
  width: 100%;
  border: 0;
  border-radius: 24px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  padding: 13px 18px;
  resize: none;
  max-height: 160px;
  box-shadow: 0 1px 0 rgba(41, 68, 34, 0.08);
}
.composer textarea::placeholder,
.composer input::placeholder { color: rgba(41, 68, 34, 0.45); }
.composer textarea:focus,
.composer input:focus { outline: 3px solid var(--coral); outline-offset: 0; }

.send {
  flex: none;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.send:hover { background: var(--green); }
.send:active { transform: scale(0.92); }
.send:disabled { opacity: 0.4; cursor: default; }

/* with JavaScript, show one field at a time (without it, both show) */
.js .field[data-step="email"] { display: none; }
.js .composer[data-step="email"] .field[data-step="message"] { display: none; }
.js .composer[data-step="email"] .field[data-step="email"] { display: flex; }
.js .composer[data-step="done"] { display: none; }

.fine {
  margin: 0;
  padding: 4px 16px max(18px, env(safe-area-inset-bottom));
  text-align: center;
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

@media (min-width: 700px) {
  .wordmark { width: 156px; }
  .mateo img { width: 180px; }
  .chat { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .bubble, .typing i { animation: none; }
}
