/* The NuPARE assistant, styled once.
 *
 * It appears on the landing page and on every subpage, and those use two
 * different stylesheets. Copying the rules into both is how they drift, so
 * they live here and both link this file. The custom properties come from
 * whichever stylesheet loaded first; both define the same palette.
 */

/* Assistant ─────────────────────────────────────────────────────────────
   Sits above everything, out of the way until it is wanted. Loaded on every
   page, so it is styled here rather than beside the script. */

.npc {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  font-family: "Satoshi", "Helvetica Neue", Arial, sans-serif;
}

.npc-launch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 48px;
  padding: 0 20px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 400 13.5px/1 "Satoshi", "Helvetica Neue", Arial, sans-serif;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(32, 34, 31, 0.18);
  transition: transform 0.3s var(--ease), background 0.3s ease, opacity 0.25s ease;
}

.npc-launch:hover {
  transform: translateY(-2px);
  background: var(--deep);
  border-color: var(--deep);
}

.npc-launch svg {
  display: block;
}

/* The launcher disappears while the panel is open rather than sitting behind
   it, which on a phone would leave two things competing for the same corner. */
.npc.is-open .npc-launch {
  opacity: 0;
  pointer-events: none;
}

/* The hidden attribute is what opens and closes this, and an author rule with
   display:flex outranks the browser's [hidden]{display:none}. Without this the
   panel is permanently visible and the close button appears to do nothing. */
.npc-panel[hidden] {
  display: none;
}

.npc-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 24px 60px rgba(32, 34, 31, 0.18);
}

.npc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 14px 20px;
  border-bottom: 1px solid var(--border);
}

.npc-head b {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.npc-head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.npc-x {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.npc-x:hover {
  background: var(--ivory);
  color: var(--ink);
}

.npc-log {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 4px;
}

.npc-msg {
  max-width: 88%;
  margin-bottom: 12px;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
}

.npc-bot {
  border: 1px solid var(--border);
  background: var(--ivory);
  color: var(--ink);
  border-bottom-left-radius: 6px;
}

.npc-bot b {
  font-weight: 500;
}

.npc-bot a {
  color: var(--deep);
}

.npc-you {
  margin-left: auto;
  background: var(--ink);
  color: var(--paper);
  border-bottom-right-radius: 6px;
}

.npc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: -4px 0 16px;
}

.npc-chips button {
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper);
  color: var(--soft);
  font: 400 12.5px/1.35 "Satoshi", "Helvetica Neue", Arial, sans-serif;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.npc-chips button:hover {
  border-color: var(--eucalyptus);
  color: var(--ink);
}

.npc-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 12px 18px;
  border-top: 1px solid var(--border);
}

.npc-form input {
  flex: 1;
  padding: 10px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 14px;
}

.npc-form input:focus {
  outline: none;
}

.npc-form button {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: background 0.2s ease;
}

.npc-form button:hover {
  background: var(--deep);
}

.npc-foot {
  margin: 0;
  padding: 0 20px 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 560px) {
  .npc {
    right: 14px;
    bottom: 14px;
  }

  .npc-panel {
    width: calc(100vw - 28px);
    height: min(76vh, 540px);
  }
}
