/* ============================================================================
   trial.css — public trial funnel (/trial, trial.html). Mobile first (most
   visitors come from an Instagram link on a phone). Indigo brand of the panel;
   fonts come from app.css (Vazirmatn / Estedad / Inter, self-hosted).
   ========================================================================== */

.tr {
  --tr-bg: #F4F5FA;
  --tr-surface: #ffffff;
  --tr-ink: #0F172A;
  --tr-ink-2: #475569;
  --tr-ink-3: #7A8699;
  --tr-line: #E6E9F2;
  --tr-accent: #4F46E5;
  --tr-accent-2: #6366F1;
  --tr-accent-soft: #EEF0FE;
  --tr-warm: #b45309;
  --tr-warm-soft: #fff3df;
  --tr-hot: #c2410c;
  --tr-radius: 16px;
  --tr-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 12px 32px -16px rgba(15, 23, 42, 0.18);
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(99, 102, 241, 0.12), transparent 60%),
    radial-gradient(700px 380px at 0% 0%, rgba(245, 158, 11, 0.08), transparent 60%),
    var(--tr-bg);
  color: var(--tr-ink);
  font-family: var(--font, "Vazirmatn", system-ui, sans-serif);
  line-height: 1.7;
}
.tr *,
.tr *::before,
.tr *::after {
  box-sizing: border-box;
}
.tr svg {
  flex-shrink: 0;
  max-width: none;
}
.tr a {
  color: inherit;
}
.tr :is(a, button, input, textarea, summary):focus-visible {
  outline: 2px solid var(--tr-accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- top bar */
.tr-top {
  display: flex;
  max-width: 76rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 auto;
  padding: 1rem clamp(1rem, 4vw, 2rem);
}
.tr-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 800;
  text-decoration: none;
}
.tr-logo-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--tr-accent-2), var(--tr-accent));
  color: #fff;
}
.tr-top-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
}
.tr-top-call {
  color: var(--tr-ink-2);
  text-decoration: none;
}
.tr-top-login {
  padding: 0.4375rem 0.875rem;
  border: 1px solid var(--tr-line);
  border-radius: 10px;
  background: var(--tr-surface);
  font-weight: 600;
  text-decoration: none;
}
.tr-top-login:hover {
  border-color: var(--tr-accent);
  color: var(--tr-accent);
}

/* ------------------------------------------------------------------- hero */
.tr-landing {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem) 2rem;
}
.tr-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
  padding: clamp(0.5rem, 3vw, 2.5rem) 0 2rem;
}
.tr-eyebrow {
  display: inline-block;
  margin-bottom: 0.875rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--tr-accent-soft);
  color: var(--tr-accent);
  font-size: 0.8125rem;
  font-weight: 600;
}
.tr-hero h1 {
  margin: 0 0 0.875rem;
  font-size: clamp(1.75rem, 5.2vw, 3rem);
  font-weight: 800;
  line-height: 1.35;
}
.tr-hero h1 em {
  display: block;
  color: var(--tr-accent);
  font-style: normal;
}
.tr-lead {
  max-width: 36rem;
  margin: 0 0 1.5rem;
  color: var(--tr-ink-2);
  font-size: clamp(0.9375rem, 1.6vw, 1.0625rem);
}

.tr-start {
  display: flex;
  max-width: 34rem;
  flex-direction: column;
  gap: 0.625rem;
  padding: 1.25rem;
  border: 1px solid var(--tr-line);
  border-radius: var(--tr-radius);
  background: var(--tr-surface);
  box-shadow: var(--tr-shadow);
}
.tr-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--tr-ink-2);
}
.tr-input {
  width: 100%;
  height: 3rem;
  padding: 0 1rem;
  border: 1px solid var(--tr-line);
  border-radius: 12px;
  background: #fbfcfc;
  color: var(--tr-ink);
  font: inherit;
  font-size: 1rem; /* 16px: no iOS zoom on focus */
}
.tr-input:focus {
  border-color: var(--tr-accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}
.tr-types {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}
.tr-type {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  gap: 0.375rem;
  padding: 0 0.875rem;
  border: 1px solid var(--tr-line);
  border-radius: 999px;
  background: var(--tr-surface);
  color: var(--tr-ink-2);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}
.tr-type:hover {
  border-color: var(--tr-accent-2);
}
.tr-type.is-on {
  border-color: var(--tr-accent);
  background: var(--tr-accent-soft);
  color: var(--tr-accent);
  font-weight: 700;
}
.tr-cta {
  display: inline-flex;
  min-height: 3.25rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--tr-accent-2), var(--tr-accent));
  box-shadow: 0 10px 22px -10px rgba(79, 70, 229, 0.6);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
}
.tr a.tr-cta {
  color: #fff;
}
.tr-cta:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}
.tr-cta:disabled {
  cursor: progress;
  opacity: 0.7;
  transform: none;
}
.tr-cta.small {
  min-height: 2.75rem;
  font-size: 0.9375rem;
}
.tr-cta.ghost,
.tr a.tr-cta.ghost {
  border: 1px solid var(--tr-line);
  background: var(--tr-surface);
  box-shadow: none;
  color: var(--tr-ink);
}
.tr-micro {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1rem;
  margin: 0.25rem 0 0;
  padding: 0;
  color: var(--tr-ink-3);
  font-size: 0.8125rem;
  list-style: none;
}
.tr-micro li::before {
  content: "✓ ";
  color: var(--tr-accent);
  font-weight: 700;
}
.tr-error {
  margin: 0;
  color: #b42318;
  font-size: 0.875rem;
}

/* hero visual (illustrative conversation) */
.tr-hero-visual {
  display: none;
}
.tr-phone {
  position: relative;
  max-width: 22rem;
  margin: 0 auto;
  padding: 0.75rem;
  border: 1px solid var(--tr-line);
  border-radius: 28px;
  background: var(--tr-surface);
  box-shadow: 0 30px 60px -30px rgba(15, 23, 42, 0.35);
}
.tr-phone-head {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.5rem 0.75rem;
  border-bottom: 1px solid var(--tr-line);
}
.tr-phone-head b {
  display: block;
  font-size: 0.875rem;
}
.tr-phone-head small {
  color: var(--tr-ink-3);
  font-size: 0.75rem;
}
.tr-av {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #f472b6, #f59e0b);
  color: #fff;
  font-weight: 800;
}
.tr-av.big {
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.125rem;
}
.tr-phone-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.875rem 0.25rem 2.5rem;
}
.tr-b {
  max-width: 85%;
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 18px;
  font-size: 0.8125rem;
  line-height: 1.6;
}
.tr-b.user {
  align-self: flex-start;
  background: #efefef;
}
.tr-b.ai {
  align-self: flex-end;
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  color: #fff;
}
.tr-phone-badge {
  position: absolute;
  bottom: -1rem;
  inset-inline-start: -1rem;
  display: flex;
  flex-direction: column;
  padding: 0.625rem 0.875rem;
  border: 1px solid #f6d9a8;
  border-radius: 14px;
  background: var(--tr-warm-soft);
  box-shadow: var(--tr-shadow);
  font-size: 0.75rem;
}
.tr-phone-badge b {
  color: var(--tr-hot);
  font-size: 0.8125rem;
}

/* proof / how / faq */
.tr-proof {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  gap: 0.75rem;
  margin: 1rem 0 2.5rem;
}
.tr-proof > div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--tr-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
}
.tr-proof b {
  color: var(--tr-accent);
  font-size: 1.125rem;
}
.tr-proof span {
  color: var(--tr-ink-2);
  font-size: 0.875rem;
}
.tr-how,
.tr-faq {
  max-width: 52rem;
  margin: 0 auto 2.5rem;
}
.tr-how h2,
.tr-faq h2 {
  margin: 0 0 1rem;
  font-size: 1.375rem;
  text-align: center;
}
.tr-how ol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  counter-reset: step;
  list-style: none;
}
.tr-how li {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  border-radius: 14px;
  background: var(--tr-surface);
  box-shadow: var(--tr-shadow);
  counter-increment: step;
}
.tr-how li::before {
  content: counter(step, persian);
  display: grid;
  width: 1.75rem;
  height: 1.75rem;
  place-items: center;
  margin-bottom: 0.25rem;
  border-radius: 50%;
  background: var(--tr-accent-soft);
  color: var(--tr-accent);
  font-weight: 800;
}
.tr-how span {
  color: var(--tr-ink-2);
  font-size: 0.875rem;
}
.tr-faq details {
  margin-bottom: 0.5rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--tr-line);
  border-radius: 12px;
  background: var(--tr-surface);
}
.tr-faq summary {
  font-weight: 700;
  cursor: pointer;
}
.tr-faq p {
  margin: 0.5rem 0 0;
  color: var(--tr-ink-2);
  font-size: 0.9375rem;
}

/* ------------------------------------------------------------------ stage */
.tr-stage {
  display: grid;
  max-width: 76rem;
  gap: 1rem;
  margin: 0 auto;
  padding: 0 clamp(0.75rem, 3vw, 2rem) 1.5rem;
}
.tr-stage > *,
.tr-hero > * {
  min-width: 0;
}
.tr-chat {
  display: flex;
  min-height: min(44rem, calc(100dvh - 6rem));
  max-height: calc(100dvh - 5.5rem);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--tr-line);
  border-radius: 20px;
  background: var(--tr-surface);
  box-shadow: var(--tr-shadow);
}
.tr-chat-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--tr-line);
}
.tr-chat-id {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  line-height: 1.4;
}
.tr-chat-id b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tr-chat-id small {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--tr-ink-3);
  font-size: 0.75rem;
}
.tr-chat-id small i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
}
.tr-ghost {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--tr-line);
  border-radius: 10px;
  background: transparent;
  color: var(--tr-ink-2);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}
.tr-role {
  margin: 0;
  padding: 0.5rem 1rem;
  background: var(--tr-accent-soft);
  color: #3730A3;
  font-size: 0.8125rem;
}
.tr-thread {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.tr-sys {
  align-self: center;
  margin: 0 0 0.25rem;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  background: #f2f4f4;
  color: var(--tr-ink-3);
  font-size: 0.75rem;
  text-align: center;
}
.tr-sys.ok {
  background: var(--tr-accent-soft);
  color: var(--tr-accent);
}
.tr-msg {
  max-width: min(80%, 34rem);
  padding: 0.625rem 0.875rem;
  border-radius: 20px;
  font-size: 0.9375rem;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: tr-in 0.18s ease-out;
}
@keyframes tr-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
/* The visitor types, so their bubbles sit on their own side in the accent
   colour (standard chat convention); the assistant answers from the other side. */
.tr-msg.user {
  align-self: flex-end;
  border-start-end-radius: 6px;
  background: linear-gradient(135deg, var(--tr-accent-2), var(--tr-accent));
  color: #fff;
}
.tr-msg.ai {
  align-self: flex-start;
  border: 1px solid var(--tr-line);
  border-start-start-radius: 6px;
  background: #f4f6f6;
  color: var(--tr-ink);
}
.tr-msg.err {
  align-self: center;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  border: 1px solid #f5c2bd;
  background: #fdecea;
  color: #8a1c13;
  font-size: 0.875rem;
}
.tr-msg.err button {
  padding: 0.25rem 0.625rem;
  border: 1px solid #e9a39b;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}
.tr-typing {
  display: inline-flex;
  gap: 4px;
  padding: 0.875rem 1rem;
}
.tr-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tr-ink-3);
  animation: tr-dot 1s infinite ease-in-out;
}
.tr-typing i:nth-child(2) {
  animation-delay: 0.15s;
}
.tr-typing i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes tr-dot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.tr-gate,
.tr-end {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 1rem;
  border: 1px solid #C7CCF9;
  border-radius: 16px;
  background: linear-gradient(180deg, #F5F6FF, #ffffff);
  animation: tr-in 0.22s ease-out;
}
.tr-gate > b,
.tr-end > b {
  font-size: 1rem;
}
.tr-gate p,
.tr-end p {
  margin: 0;
  color: var(--tr-ink-2);
  font-size: 0.875rem;
}
.tr-gate-row {
  display: flex;
  gap: 0.5rem;
}
.tr-gate-row .tr-input {
  flex: 1;
  min-width: 0;
}
.tr-gate-row .tr-cta {
  flex: none;
}

.tr-suggest {
  display: flex;
  gap: 0.5rem;
  padding: 0 1rem 0.625rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.tr-suggest button {
  flex: none;
  padding: 0.4375rem 0.875rem;
  border: 1px solid var(--tr-line);
  border-radius: 999px;
  background: var(--tr-surface);
  color: var(--tr-ink);
  font: inherit;
  font-size: 0.8125rem;
  white-space: nowrap;
  cursor: pointer;
}
.tr-suggest button:hover {
  border-color: var(--tr-accent);
  color: var(--tr-accent);
}
.tr-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-top: 1px solid var(--tr-line);
}
.tr-composer textarea {
  flex: 1;
  min-height: 2.75rem;
  max-height: 8rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--tr-line);
  border-radius: 22px;
  background: #fbfcfc;
  color: var(--tr-ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  resize: none;
  field-sizing: content;
}
.tr-composer textarea:focus {
  border-color: var(--tr-accent);
  outline: none;
}
.tr-composer textarea:disabled {
  background: #f1f3f3;
}
.tr-composer button {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--tr-accent);
  color: #fff;
  cursor: pointer;
  transform: scaleX(-1); /* send arrow points toward reading direction in RTL */
}
.tr-composer button:disabled {
  background: #c9d3d1;
  cursor: not-allowed;
}
.tr-meter {
  margin: 0;
  padding: 0 1rem 0.625rem;
  color: var(--tr-ink-3);
  font-size: 0.75rem;
  text-align: center;
}

/* side panel */
.tr-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.tr-card {
  padding: 1.125rem;
  border: 1px solid var(--tr-line);
  border-radius: var(--tr-radius);
  background: var(--tr-surface);
  box-shadow: var(--tr-shadow);
}
.tr-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}
.tr-lead-card {
  display: grid;
  gap: 0.5rem;
  margin: 0;
}
.tr-lead-card > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--tr-line);
  font-size: 0.875rem;
}
.tr-lead-card dt {
  color: var(--tr-ink-3);
}
.tr-lead-card dd {
  margin: 0;
  font-weight: 700;
  text-align: end;
}
.tr-temp {
  padding: 0.0625rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8125rem;
}
.tr-temp.hot {
  background: #ffedd5;
  color: var(--tr-hot);
}
.tr-temp.warm {
  background: var(--tr-warm-soft);
  color: var(--tr-warm);
}
.tr-temp.cool {
  background: #eef2f2;
  color: var(--tr-ink-2);
}
.tr-fine {
  margin: 0.75rem 0 0;
  color: var(--tr-ink-3);
  font-size: 0.8125rem;
}
.tr-convert {
  border-color: #C7CCF9;
  background: linear-gradient(180deg, #F5F6FF, #ffffff);
}
.tr-convert ul {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}
.tr-convert li {
  padding: 0.1875rem 0;
  font-size: 0.875rem;
}
.tr-convert li::before {
  content: "✓ ";
  color: var(--tr-accent);
  font-weight: 800;
}
.tr-cta-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* compact CTA inside the chat card — phones/tablets only (desktop has the side card) */
.tr-inline-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0.75rem 0.5rem;
  padding: 0.5rem 0.5rem 0.5rem 0.75rem;
  border: 1px solid #C7CCF9;
  border-radius: 14px;
  background: #F5F6FF;
  font-size: 0.8125rem;
  font-weight: 600;
  animation: tr-in 0.25s ease-out;
}
.tr-inline-cta .tr-cta.small {
  min-height: 2.5rem;
  padding: 0 0.875rem;
  font-size: 0.875rem;
}

.tr-foot {
  display: flex;
  max-width: 76rem;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 auto;
  padding: 1.25rem clamp(1rem, 4vw, 2rem) 1.5rem;
  border-top: 1px solid var(--tr-line);
  color: var(--tr-ink-3);
  font-size: 0.8125rem;
}

/* ------------------------------------------------------------- breakpoints */
@media (min-width: 900px) {
  .tr-hero {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  }
  .tr-hero-visual {
    display: block;
  }
}
@media (min-width: 1024px) {
  .tr-stage {
    grid-template-columns: minmax(0, 1fr) 21rem;
    align-items: start;
  }
  .tr-side {
    position: sticky;
    top: 1rem;
  }
  .tr-inline-cta {
    display: none;
  }
}
@media (max-width: 1023.98px) {
  .tr-chat {
    min-height: calc(100dvh - 9rem);
  }
}
@media (max-width: 479.98px) {
  .tr-top-call {
    display: none;
  }
  .tr-msg {
    max-width: 88%;
  }
  .tr-inline-cta span {
    display: none;
  }
  .tr-inline-cta .tr-cta {
    flex: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tr-msg,
  .tr-gate,
  .tr-end,
  .tr-inline-cta,
  .tr-typing i {
    animation: none;
  }
}

/* headings in the display face (app.css loads Estedad) */
.tr h1,
.tr h2,
.tr-proof b,
.tr-logo {
  font-family: var(--font-display, var(--font));
}
/* app.css styles bare elements globally; keep the funnel's own look */
.tr [hidden] {
  display: none !important;
}
.tr main[hidden] {
  display: none !important;
}
