/* JOG AI - the run-club finder box, shared by the homepage and every
 * generated directory page. Mounts into [data-jog-ai]; see jog-ai.js.
 *
 * Everything is scoped under .jai so it can drop into index.html (which
 * has its own stylesheet) and into the generated pages (which share CSS
 * in generate_seo_pages.js) without either one bleeding in.
 *
 * The box renders its own idle state from markup in the page, so there is
 * no layout shift and no blank space while the script loads - the first
 * paint already shows the heading, the input and the chips. */

.jai {
  --jai-accent: #6C4CF6;
  --jai-accent-soft: #EEEBFE;
  --jai-ink: #111111;
  --jai-ink-2: #555551;
  --jai-ink-3: #8E8E8A;
  --jai-surface: #FFFFFF;
  --jai-line: #DDDDD8;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--jai-surface);
  border: 1.5px solid var(--jai-ink);
  border-radius: 28px;
  padding: 26px 24px 22px;
  box-shadow: 0 2px 0 var(--jai-ink);
  text-align: left;
  color: var(--jai-ink);
}
.jai *, .jai *::before, .jai *::after { box-sizing: border-box; }

.jai-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 800; letter-spacing: 1.3px;
  text-transform: uppercase; color: var(--jai-accent);
  margin-bottom: 12px;
}
.jai-badge svg { width: 14px; height: 14px; display: block; }

.jai h2.jai-title, .jai .jai-title {
  font-size: 26px; font-weight: 900; letter-spacing: -0.9px;
  line-height: 1.15; margin: 0 0 8px; color: var(--jai-ink);
}
.jai-sub {
  font-size: 15px; line-height: 1.55; color: var(--jai-ink-2);
  margin: 0 0 18px; max-width: 54ch;
}

/* composer */
.jai-form { display: flex; flex-direction: column; gap: 10px; }
.jai-field {
  display: flex; align-items: flex-end; gap: 10px;
  border: 1.5px solid var(--jai-line); border-radius: 20px;
  padding: 10px 10px 10px 16px; background: #FBFBF9;
  transition: border-color .15s, box-shadow .15s;
}
.jai-field:focus-within {
  border-color: var(--jai-accent);
  box-shadow: 0 0 0 3px var(--jai-accent-soft);
}
.jai-input {
  flex: 1; border: 0; background: transparent; resize: none;
  font-family: inherit; font-size: 16px; line-height: 1.45;
  color: var(--jai-ink); padding: 6px 0; max-height: 132px; min-height: 30px;
}
.jai-input:focus { outline: none; }
.jai-input::placeholder { color: var(--jai-ink-3); }

.jai-send {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--jai-ink); color: #FFFFFF; transition: opacity .15s;
}
.jai-send:hover { opacity: .85; }
.jai-send:disabled { opacity: .35; cursor: default; }
.jai-send svg { width: 18px; height: 18px; display: block; }

.jai-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.jai-chip {
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--jai-ink-2); background: #F0F0EC;
  border: 1px solid var(--jai-line); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; transition: all .15s;
}
.jai-chip:hover { border-color: var(--jai-accent); color: var(--jai-accent); }

.jai-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  margin-top: 14px; font-size: 12.5px; color: var(--jai-ink-3);
}
.jai-loc {
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--jai-accent); background: none; border: 0; padding: 0;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.jai-loc[data-on="1"] { color: var(--jai-ink-2); }

/* conversation */
.jai-thread { display: none; flex-direction: column; gap: 16px; margin-bottom: 18px; }
.jai[data-started="1"] .jai-thread { display: flex; }
.jai[data-started="1"] .jai-intro { display: none; }
.jai[data-started="1"] .jai-chips { display: none; }

.jai-msg { font-size: 15.5px; line-height: 1.6; }
.jai-msg-you {
  align-self: flex-end; max-width: 85%;
  background: var(--jai-ink); color: #FFFFFF;
  border-radius: 18px 18px 4px 18px; padding: 11px 16px;
  font-weight: 500;
}
.jai-msg-ai { color: var(--jai-ink); white-space: pre-line; }
.jai-msg-err {
  color: #8A2A2A; background: #FBEDED; border: 1px solid #F0D2D2;
  border-radius: 14px; padding: 12px 15px; font-size: 14.5px;
}

.jai-thinking { display: flex; align-items: center; gap: 10px; color: var(--jai-ink-2); font-size: 14.5px; }
.jai-dots { display: inline-flex; gap: 4px; }
.jai-dots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--jai-accent);
  animation: jai-bounce 1.1s infinite ease-in-out;
}
.jai-dots i:nth-child(2) { animation-delay: .15s; }
.jai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes jai-bounce {
  0%, 60%, 100% { opacity: .25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .jai-dots i { animation: none; opacity: .6; }
}

/* club cards */
.jai-picks { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.jai-pick {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--jai-line); border-radius: 16px;
  padding: 14px 16px; background: #FBFBF9; transition: border-color .15s;
}
.jai-pick:hover { border-color: var(--jai-accent); }
.jai-pick-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.jai-pick-name { font-size: 15.5px; font-weight: 800; letter-spacing: -.3px; }
.jai-score {
  flex: none; font-size: 11px; font-weight: 800; letter-spacing: .6px;
  color: var(--jai-accent); background: var(--jai-accent-soft);
  border-radius: 999px; padding: 4px 9px; white-space: nowrap;
}
.jai-pick-why { font-size: 14px; color: var(--jai-ink-2); margin-top: 5px; line-height: 1.5; }
.jai-pick-meta { font-size: 12.5px; color: var(--jai-ink-3); margin-top: 6px; }

.jai-cta {
  margin-top: 16px; padding: 16px 18px;
  background: var(--jai-accent-soft); border: 1px solid #DCD4FC;
  border-radius: 18px; font-size: 14px; color: var(--jai-ink-2);
}
.jai-cta a { color: var(--jai-accent); font-weight: 700; text-decoration: none; }
.jai-cta a:hover { text-decoration: underline; }

/* compact variant, used on club / event / city pages */
.jai[data-size="compact"] { padding: 20px 18px 18px; border-radius: 22px; }
.jai[data-size="compact"] .jai-title { font-size: 19px; letter-spacing: -.5px; }
.jai[data-size="compact"] .jai-sub { font-size: 14px; margin-bottom: 14px; }
.jai[data-size="compact"] .jai-input { font-size: 15.5px; }

@media (max-width: 560px) {
  .jai { padding: 22px 18px 18px; border-radius: 22px; }
  .jai .jai-title { font-size: 22px; }
  .jai-sub { font-size: 14.5px; }
}
