/* Paris, the Valtrix AI agent — site-wide chat widget */
.paris-launcher {
  position: fixed;
  right: calc(1.35rem + env(safe-area-inset-right, 0px));
  bottom: calc(1.35rem + env(safe-area-inset-bottom, 0px) + var(--paris-lift, 0px));
  z-index: 160;
  transition: bottom 0.28s ease;
  width: 4rem;
  height: 4rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #0b1b33;
  color: var(--paper, #f3f0e8);
  box-shadow: 0 1px 2px rgba(11, 27, 51, 0.12), 0 14px 36px -10px rgba(11, 27, 51, 0.5);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.paris-launcher img,
.paris-launcher svg {
  width: 4rem;
  height: 4rem;
  display: block;
  border-radius: 50%;
}

.paris-launcher:hover {
  transform: translateY(-1px);
}

.paris-launcher:focus-visible {
  outline: 2px solid var(--gold, #c2a061);
  outline-offset: 3px;
}

.paris-panel[hidden] {
  display: none !important;
}

.paris-panel {
  position: fixed;
  right: calc(1.35rem + env(safe-area-inset-right, 0px));
  bottom: calc(6.15rem + env(safe-area-inset-bottom, 0px) + var(--paris-lift, 0px));
  z-index: 165;
  transition: bottom 0.28s ease;
  width: min(24.5rem, calc(100vw - 1.5rem));
  height: min(36rem, calc(100dvh - 7rem));
  max-height: calc(100dvh - 7rem);
  display: flex;
  flex-direction: column;
  background: var(--paper, #f3f0e8);
  color: var(--ink, #0b1b33);
  border-top: 2px solid var(--gold, #c2a061);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(11, 27, 51, 0.08), 0 28px 70px -18px rgba(11, 27, 51, 0.5);
  overflow: hidden;
}

.paris-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem 0.8rem 1rem;
  background: #0b1b33;
  color: var(--paper, #f3f0e8);
}

.paris-header img {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px #c2a061;
}

.paris-header h2 {
  margin: 0;
  font-family: var(--serif, Newsreader, Georgia, serif);
  font-weight: 500;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--paper, #f3f0e8);
  line-height: 1.2;
}

.paris-header p {
  margin: 0.1rem 0 0;
  font-family: var(--mono, "Geist Mono", ui-monospace, monospace);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c2a061;
}

.paris-close {
  margin-left: auto;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--paper, #f3f0e8);
  cursor: pointer;
  border-radius: 2px;
}

.paris-disclaimer {
  margin: 0;
  padding: 0.55rem 1rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted, #34454f);
  background: rgba(11, 27, 51, 0.04);
  border-bottom: 1px solid var(--line, rgba(11, 27, 51, 0.14));
}

.paris-log {
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.paris-msg {
  max-width: 100%;
  font-size: 0.95rem;
  line-height: 1.5;
}

.paris-msg p { margin: 0; }
.paris-msg p + p { margin-top: 0.55rem; }

.paris-msg-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  margin-top: 0.65rem;
}

.paris-msg-links a {
  font-size: 0.9rem;
  font-weight: 500;
}

.paris-msg.is-paris {
  align-self: flex-start;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--ink, #0b1b33);
  width: 100%;
}
.paris-msg-avatar {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #0b1b33;
}
.paris-msg-body {
  flex: 1 1 auto;
  max-width: calc(100% - 2.4rem);
  padding: 0.7rem 0.85rem;
  background: #fff;
  border: 1px solid var(--line, rgba(11, 27, 51, 0.14));
  border-radius: 2px 10px 10px 10px;
}

.paris-msg.is-user {
  align-self: flex-end;
  max-width: 92%;
  padding: 0.7rem 0.85rem;
  background: #0b1b33;
  color: var(--paper, #f3f0e8);
  border-radius: 10px 2px 10px 10px;
}

.paris-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.35rem 1rem 0.75rem;
}

.paris-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.2rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line-strong, rgba(11, 27, 51, 0.28));
  border-radius: 999px;
  background: transparent;
  color: var(--ink, #0b1b33);
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
}

.paris-chip:hover { background: rgba(11, 27, 51, 0.05); }

.paris-form {
  display: flex;
  gap: 0.45rem;
  padding: 0.7rem 0.75rem 0.85rem;
  border-top: 1px solid var(--line, rgba(11, 27, 51, 0.14));
  background: var(--paper, #f3f0e8);
}

.paris-form label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.paris-form textarea {
  flex: 1 1 auto;
  resize: none;
  min-height: 2.75rem;
  max-height: 6.5rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line-strong, rgba(11, 27, 51, 0.28));
  border-radius: 2px;
  background: #fff;
  color: var(--ink, #0b1b33);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
}

.paris-form button[type="submit"] {
  flex: 0 0 auto;
  min-height: 2.75rem;
  padding: 0 0.9rem;
  align-self: flex-end;
}

body.trial-popup-open .paris-launcher,
body.trial-popup-open .paris-panel,
body.trial-popup-open .paris-nudge,
body.trial-popup-open .paris-label {
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .paris-launcher:hover { transform: none; }
  .paris-launcher,
  .paris-panel,
  .paris-nudge { transition: none; }
}

@media (max-width: 430px) {
  .paris-launcher {
    right: calc(0.85rem + env(safe-area-inset-right, 0px));
    bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px) + var(--paris-lift, 0px));
    width: 3.5rem;
    height: 3.5rem;
  }
  .paris-launcher img,
  .paris-launcher svg {
    width: 3.5rem;
    height: 3.5rem;
  }
  .paris-label { display: none !important; }

  .paris-panel {
    inset: 0.5rem 0.5rem 0.5rem 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
    transition: none;
    width: auto;
    height: auto;
    max-height: none;
    border-radius: 2px;
  }
}

/* Proactive "Need help?" bubble, beside (desktop) or above (mobile) the launcher */
.paris-nudge[hidden] {
  display: none !important;
}

.paris-nudge {
  position: fixed;
  z-index: 161;
  right: calc(1.35rem + 4rem + 0.7rem + env(safe-area-inset-right, 0px));
  bottom: calc(1.35rem + env(safe-area-inset-bottom, 0px) + var(--paris-lift, 0px));
  max-width: min(18.25rem, calc(100vw - 7.2rem));
  display: flex;
  align-items: flex-start;
  gap: 0.15rem;
  background: var(--paper, #f3f0e8);
  color: var(--ink, #0b1b33);
  border-top: 2px solid var(--gold, #c2a061);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(11, 27, 51, 0.08), 0 16px 40px -12px rgba(11, 27, 51, 0.45);
  padding: 0.65rem 0.3rem 0.65rem 0.9rem;
  animation: paris-nudge-in 0.32s ease-out;
}

.paris-nudge-open {
  flex: 1 1 auto;
  margin: 0;
  padding: 0.15rem 0.2rem 0.15rem 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}

.paris-nudge-dismiss {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: -0.15rem;
  border: 0;
  background: transparent;
  color: var(--ink, #0b1b33);
  cursor: pointer;
  border-radius: 2px;
}

.paris-nudge-dismiss:hover { color: var(--ink-soft, #34454f); }
.paris-nudge-open:focus-visible,
.paris-nudge-dismiss:focus-visible {
  outline: 2px solid var(--gold, #c2a061);
  outline-offset: 2px;
}

@keyframes paris-nudge-in {
  from { opacity: 0; transform: translateY(0.4rem); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .paris-nudge { animation: none; }
}

@media (max-width: 430px) {
  .paris-nudge {
    right: calc(0.85rem + env(safe-area-inset-right, 0px));
    bottom: calc(0.85rem + 3.5rem + 0.55rem + env(safe-area-inset-bottom, 0px) + var(--paris-lift, 0px));
    max-width: min(16.25rem, calc(100vw - 1.7rem - env(safe-area-inset-right, 0px)));
    padding: 0.6rem 0.25rem 0.6rem 0.8rem;
  }

  .paris-nudge-open { font-size: 0.88rem; }
}

.paris-nudge.is-away {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.paris-nudge {
  transition: opacity 0.2s ease, visibility 0.2s ease, bottom 0.28s ease;
}

@media (prefers-reduced-motion: reduce) {
  .paris-nudge { transition: none; }
}

/* Keep footer legal lines above the bubble + launcher stack */
.site-footer {
  padding-bottom: calc(6.75rem + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 430px) {
  .site-footer {
    padding-bottom: calc(8.5rem + env(safe-area-inset-bottom, 0px));
  }
}

/* Let primary actions scroll to a clear area above the launcher */
a.btn, button.btn, button[type="submit"], input[type="submit"] {
  scroll-margin-bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px) + var(--paris-lift, 0px));
}
@media (max-width: 430px) {
  a.btn, button.btn, button[type="submit"], input[type="submit"] {
    scroll-margin-bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px) + var(--paris-lift, 0px));
  }
}

/* Desktop name pill */
.paris-label[hidden] { display: none !important; }
.paris-label {
  position: fixed;
  z-index: 160;
  right: calc(1.35rem + 4rem + 0.45rem + env(safe-area-inset-right, 0px));
  bottom: calc(1.35rem + 1.05rem + env(safe-area-inset-bottom, 0px) + var(--paris-lift, 0px));
  margin: 0;
  padding: 0.2rem 0.55rem 0.22rem;
  border: 0;
  border-radius: 999px;
  background: var(--paper, #f3f0e8);
  color: var(--ink, #0b1b33);
  border-top: 2px solid var(--gold, #c2a061);
  box-shadow: 0 1px 2px rgba(11, 27, 51, 0.08), 0 10px 24px -12px rgba(11, 27, 51, 0.45);
  font-family: var(--sans, "Instrument Sans", system-ui, sans-serif);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
  cursor: pointer;
  transition: bottom 0.28s ease;
}
.paris-label:focus-visible {
  outline: 2px solid var(--gold, #c2a061);
  outline-offset: 2px;
}

/* First-appearance pulse */
.paris-launcher {
  overflow: visible;
}
.paris-launcher.is-entering::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid #c2a061;
  animation: paris-pulse 1.6s ease-out 2;
  pointer-events: none;
}
@keyframes paris-pulse {
  0% { opacity: 0.85; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.5); }
}
@media (prefers-reduced-motion: reduce) {
  .paris-launcher.is-entering::after { animation: none; display: none; }
  .paris-label { transition: none; }
}

/* Typing indicator */
.paris-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  min-height: 1.1rem;
  padding: 0.1rem 0.05rem;
}
.paris-dots i {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: paris-dot 1s ease-in-out infinite;
}
.paris-dots i:nth-child(2) { animation-delay: 0.15s; }
.paris-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes paris-dot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-0.15rem); }
}
@media (prefers-reduced-motion: reduce) {
  .paris-dots i { animation: none; opacity: 0.7; }
}
