/* The guide's animated tips and plan chips (templates/start_guide.html, /start/guide).
 *
 * Each tip is a tiny WhatsApp chat: the customer's message slides in, Andal "types", then its answer appears, and the
 * loop starts again. CSS keyframes only, no script. Every element's own style is its FINISHED state (both bubbles
 * shown, typing dots hidden), and every keyframe list starts and ends there, so:
 *   - without animation (reduced motion, the scenery paused, an old browser) the tips simply stand still, finished;
 *   - a tip waiting for its turn (the stagger below) shows its finished chat, never an empty box.
 * Phone first (a 390px screen), the coast colours (coast_auth.css custom properties), no web fonts and no files.
 */

.gt-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.gt-hi {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: 13px;
  line-height: 19px;
  color: var(--foreground);
}

.gt-emo {
  flex-shrink: 0;
  font-size: 15px;
  line-height: 19px;
}

/* --- Tips, grouped into everyday categories --------------------------------- */

.gt-cat {
  margin-top: 16px;
}

.gt-cat-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: var(--foreground);
}

.gt-cat .gt-tips {
  margin-top: 8px;
}

.gt-tips {
  display: grid;
  gap: 12px;
  margin-top: 10px;
  padding: 0;
  list-style: none;
}

.gt-tip {
  --gt-cycle: 10s;
  --gt-delay: 0s;
  min-width: 0;
  padding: 10px 10px 12px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.gt-tip:nth-child(2) { --gt-delay: 1.1s; }
.gt-tip:nth-child(3) { --gt-delay: 2.2s; }
.gt-tip:nth-child(4) { --gt-delay: 3.3s; }
.gt-tip:nth-child(5) { --gt-delay: 4.4s; }
.gt-tip:nth-child(6) { --gt-delay: 5.5s; }
.gt-tip:nth-child(7) { --gt-delay: 6.6s; }
.gt-tip:nth-child(8) { --gt-delay: 7.7s; }
.gt-tip:nth-child(9) { --gt-delay: 8.8s; }
.gt-tip:nth-child(10) { --gt-delay: 9.9s; }
.gt-tip:nth-child(11) { --gt-delay: 11s; }
.gt-tip:nth-child(12) { --gt-delay: 12.1s; }

.gt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 13px;
  line-height: 18px;
}

.gt-head b {
  font-weight: 600;
  color: var(--foreground);
}

.gt-on {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  font-size: 11px;
  line-height: 16px;
  color: var(--accent);
}

.gt-note {
  margin-top: 6px;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted-foreground);
}

/* The chat, in WhatsApp's own colours so it reads as a chat at a glance. */
.gt-chat {
  --gt-wall: #efeae2;
  --gt-out: #d9fdd3;
  --gt-in: #ffffff;
  --gt-ink: #111b21;
  --gt-soft: #54656f;
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 10px;
  border-radius: 10px;
  background: var(--gt-wall);
}

@media (prefers-color-scheme: dark) {
  .gt-chat {
    --gt-wall: #0b141a;
    --gt-out: #005c4b;
    --gt-in: #202c33;
    --gt-ink: #e9edef;
    --gt-soft: #8696a0;
  }
}

.gt-msg {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 18px;
  color: var(--gt-ink);
  overflow-wrap: anywhere;
  box-shadow: 0 1px 0 rgb(11 20 26 / 0.12);
}

.gt-msg b {
  font-weight: 600;
}

.gt-ask {
  justify-self: end;
  max-width: 88%;
  border-top-right-radius: 3px;
  background: var(--gt-out);
}

.gt-slot {
  position: relative;
  justify-self: start;
  max-width: 88%;
  min-width: 0;
}

.gt-reply {
  border-top-left-radius: 3px;
  background: var(--gt-in);
}

.gt-dots {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  gap: 3px;
  padding: 10px 11px;
  border-radius: 10px;
  border-top-left-radius: 3px;
  background: var(--gt-in);
  opacity: 0;
  pointer-events: none;
}

.gt-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gt-soft);
}

.gt-source,
.gt-foot {
  display: block;
  margin-top: 6px;
  font-size: 11.5px;
  line-height: 15px;
  color: var(--gt-soft);
}

/* A voice note: play mark, a little waveform, its length. */
.gt-voice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.gt-play {
  font-size: 11px;
  color: var(--gt-soft);
}

.gt-wave {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 16px;
}

.gt-wave i {
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: var(--gt-soft);
}

.gt-wave i:nth-child(2) { height: 8px; }
.gt-wave i:nth-child(3) { height: 15px; }
.gt-wave i:nth-child(4) { height: 10px; }
.gt-wave i:nth-child(5) { height: 14px; }
.gt-wave i:nth-child(6) { height: 7px; }
.gt-wave i:nth-child(7) { height: 11px; }

/* A receipt photo, drawn. */
.gt-receipt {
  display: block;
  width: 76px;
  margin: 2px 0 6px auto;
  padding: 6px 7px 5px;
  border-radius: 3px;
  background: #fffdf7;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.18);
  transform: rotate(-3deg);
}

.gt-receipt i {
  display: block;
  height: 3px;
  margin-bottom: 3px;
  border-radius: 2px;
  background: #d5d8e0;
}

.gt-receipt i:nth-child(2) { width: 70%; }
.gt-receipt i:nth-child(3) { width: 85%; }

.gt-receipt b {
  display: block;
  font: 700 10px/12px ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  text-align: right;
  color: #1f2937;
}

/* A school letter: the receipt's paper, the school's name on top. */
.gt-letter {
  width: 64px;
  transform: rotate(2deg);
}

.gt-letter b {
  margin-bottom: 4px;
  text-align: left;
}

/* A photo of the fridge. */
.gt-pic {
  display: block;
  width: 76px;
  height: 50px;
  margin: 2px 0 6px auto;
  border-radius: 6px;
  background: linear-gradient(180deg, #eef4f8, #d4e2ec);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.18);
  font-size: 17px;
  line-height: 50px;
  text-align: center;
}

/* The space the assistant built: a water tracker filling up. */
.gt-space {
  display: block;
  margin-top: 6px;
  padding: 8px 9px;
  border-radius: 8px;
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--foreground);
}

.gt-space-title {
  display: block;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
}

.gt-glasses {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.gt-glasses i {
  width: 12px;
  height: 15px;
  border-radius: 2px 2px 4px 4px;
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.gt-glasses i:nth-child(-n+3) {
  background: var(--accent);
}

/* Refine: the list of better requests, with the first one tapped. */
.gt-rows {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.gt-row {
  display: block;
  padding: 5px 8px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gt-soft) 35%, transparent);
  font-size: 12px;
  line-height: 16px;
  color: #027eb5;
}

@media (prefers-color-scheme: dark) {
  .gt-row {
    color: #53bdeb;
  }
}

.gt-pick {
  background: color-mix(in srgb, #25d366 22%, transparent);
}

/* --- The motion -------------------------------------------------------------
 * One cycle per tip (--gt-cycle), started --gt-delay after the page: the finished chat fades, the question comes in,
 * Andal types, the answer comes in and stays until the next cycle. Keep 0% and 100% equal to the finished state.
 * ------------------------------------------------------------------------- */

.gt-ask {
  animation: gt-ask var(--gt-cycle) ease-out var(--gt-delay) infinite both;
}

.gt-reply {
  animation: gt-reply var(--gt-cycle) ease-out var(--gt-delay) infinite both;
}

.gt-dots {
  animation: gt-typing var(--gt-cycle) linear var(--gt-delay) infinite both;
}

.gt-dots i {
  animation: gt-bounce 1s ease-in-out infinite;
}

.gt-dots i:nth-child(2) { animation-delay: 0.15s; }
.gt-dots i:nth-child(3) { animation-delay: 0.3s; }

.gt-wave i {
  animation: gt-wave 1.1s ease-in-out infinite;
}

.gt-wave i:nth-child(2n) { animation-delay: 0.2s; }
.gt-wave i:nth-child(3n) { animation-delay: 0.4s; }

.gt-glasses i:nth-child(-n+3) {
  animation: gt-fill var(--gt-cycle) ease-out var(--gt-delay) infinite both;
}

.gt-pick {
  animation: gt-pick var(--gt-cycle) ease-out var(--gt-delay) infinite both;
}

@keyframes gt-ask {
  0%, 100% { opacity: 1; transform: none; }
  3% { opacity: 0; transform: translateY(4px); }
  8% { opacity: 0; transform: translateY(8px); }
  14% { opacity: 1; transform: none; }
}

@keyframes gt-typing {
  0%, 20% { opacity: 0; }
  23%, 40% { opacity: 1; }
  43%, 100% { opacity: 0; }
}

@keyframes gt-reply {
  0%, 100% { opacity: 1; transform: none; }
  3% { opacity: 0; transform: translateY(4px); }
  42% { opacity: 0; transform: translateY(8px); }
  48% { opacity: 1; transform: none; }
}

@keyframes gt-bounce {
  0%, 60%, 100% { opacity: 0.45; transform: none; }
  30% { opacity: 1; transform: translateY(-3px); }
}

@keyframes gt-wave {
  0%, 100% { transform: none; }
  50% { transform: scaleY(0.45); }
}

@keyframes gt-fill {
  0%, 100% { background-color: var(--accent); }
  3%, 55% { background-color: transparent; }
  62% { background-color: var(--accent); }
}

@keyframes gt-pick {
  0%, 100% { background-color: color-mix(in srgb, #25d366 22%, transparent); }
  3%, 70% { background-color: transparent; }
  76% { background-color: color-mix(in srgb, #25d366 22%, transparent); }
}

/* "Pause scenery" (coast_base.html sets data-paused on the scene) also stops the tips, finished. */
.coast-auth:has(.beach-scene[data-paused="true"]) .gt-tip *,
.coast-auth:has(.beach-scene[data-paused="true"]) .gt-tip *::before {
  animation: none !important;
}

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

/* --- What each plan has ----------------------------------------------------- */

.gt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding: 0;
  list-style: none;
}

.gt-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: 12px;
  line-height: 16px;
  color: var(--foreground);
}

.gt-plus {
  margin-top: 6px;
}

.gt-plus .gt-chip::before {
  content: "+";
  margin-right: 3px;
  font-weight: 700;
  color: var(--accent);
}
