/* Floating action button — liquid glass, icon-only until hover/focus */
.pa-fab {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  z-index: 1100;
  display: grid;
  grid-template-columns: auto 0fr;
  align-items: center;
  gap: 0;
  padding: 0.82rem;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.52) 0%,
    rgba(255, 255, 255, 0.16) 48%,
    rgba(255, 255, 255, 0.34) 100%
  );
  backdrop-filter: blur(28px) saturate(1.9);
  -webkit-backdrop-filter: blur(28px) saturate(1.9);
  color: var(--green, #2ecc71);
  font-family: var(--font-body, var(--sans));
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: visible;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.95),
    inset 0 -1px 1px rgba(255, 255, 255, 0.3),
    inset 1px 0 1px rgba(255, 255, 255, 0.35),
    0 14px 36px rgba(15, 14, 12, 0.12),
    0 3px 8px rgba(15, 14, 12, 0.07);
  transition:
    transform 0.55s cubic-bezier(0.34, 1.45, 0.64, 1),
    box-shadow 0.55s cubic-bezier(0.34, 1.25, 0.64, 1),
    opacity 0.35s ease,
    visibility 0.35s ease,
    background 0.55s cubic-bezier(0.34, 1.25, 0.64, 1),
    padding 0.55s cubic-bezier(0.34, 1.25, 0.64, 1),
    gap 0.55s cubic-bezier(0.34, 1.25, 0.64, 1),
    grid-template-columns 0.55s cubic-bezier(0.34, 1.25, 0.64, 1);
}

/* Specular highlight — the "liquid" sheen */
.pa-fab::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(130% 100% at 18% -10%, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.14) 42%, transparent 68%),
    radial-gradient(90% 70% at 85% 115%, rgba(255, 255, 255, 0.4) 0%, transparent 55%);
  opacity: 0.85;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.pa-fab:hover::before,
.pa-fab:focus-visible::before {
  opacity: 1;
}

.pa-fab:hover,
.pa-fab:focus-visible {
  transform: translateY(-3px) scale(1.02);
  grid-template-columns: auto 1fr;
  gap: 0.72rem;
  padding: 0.82rem 1.35rem 0.82rem 0.95rem;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.66) 0%,
    rgba(255, 255, 255, 0.28) 48%,
    rgba(255, 255, 255, 0.48) 100%
  );
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 1),
    inset 0 -1px 1px rgba(255, 255, 255, 0.4),
    0 22px 48px rgba(15, 14, 12, 0.14),
    0 4px 10px rgba(15, 14, 12, 0.08);
}

.pa-fab:active {
  transform: translateY(-1px) scale(0.97);
}

.pa-fab-icon {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0.8px solid rgba(255, 255, 255, 0.75);
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.5) 55%, rgba(216, 243, 226, 0.45) 100%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.9),
    0 2px 6px rgba(15, 14, 12, 0.06);
  color: var(--accent);
  flex-shrink: 0;
  overflow: visible;
  transition:
    transform 0.55s cubic-bezier(0.34, 1.45, 0.64, 1),
    border-color 0.45s ease,
    box-shadow 0.45s ease;
}

/* Figma node 1753:2729 — chat-smile-ai icon + animated star overlay */
.pa-fab-chat {
  --pa-icon-scale: 0.541667; /* 26px / 48px Figma artboard */
  --pa-star-jump: -11.375px; /* -21px scaled to icon size */
  position: relative;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.pa-fab-chat-icon {
  position: absolute;
  left: 8.33%;
  top: 8.33%;
  width: 83.34%;
  height: 83.34%;
  display: block;
}

.pa-fab:hover .pa-fab-icon,
.pa-fab:focus-visible .pa-fab-icon {
  transform: scale(1.06);
  border-color: rgba(212, 65, 11, 0.25);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.95),
    0 0 0 3px rgba(212, 65, 11, 0.08),
    0 3px 8px rgba(15, 14, 12, 0.08);
}

/* Figma node 1753:2739 “Star 1” — jump / squash / half-turn loop (~2.19s) */
.pa-fab-star-wrap {
  position: absolute;
  left: 58.333%;
  top: -8.333%;
  width: 54.167%;
  height: 54.167%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transform-origin: center center;
  will-change: translate, scale, rotate;
  animation:
    pa-star-rotate 2.189449s linear infinite,
    pa-star-jump 2.189449s linear infinite,
    pa-star-squash 2.189449s linear infinite;
}

.pa-fab-star-inner {
  width: 68.2%;
  height: 68.2%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(180deg);
}

.pa-fab-star {
  display: block;
  width: 100%;
  height: 100%;
}

@keyframes pa-star-rotate {
  0% { rotate: 0deg; }
  5.467% {
    animation-timing-function: ease-out;
    rotate: 0deg;
  }
  47.008% { rotate: 180deg; }
  100% { rotate: 180deg; }
}

@keyframes pa-star-jump {
  0% {
    animation-timing-function: cubic-bezier(0.68, 0.004, 0.357, 0.993);
    translate: 0 0;
  }
  27.447% { translate: 0 var(--pa-star-jump, -11.375px); }
  28.21% {
    animation-timing-function: cubic-bezier(0.68, 0.004, 0.357, 0.993);
    translate: 0 var(--pa-star-jump, -11.375px);
  }
  54.964% { translate: 0 0; }
  100% { translate: 0 0; }
}

@keyframes pa-star-squash {
  0% {
    animation-timing-function: cubic-bezier(0.68, 0.004, 0.357, 0.993);
    scale: 1;
  }
  27.309% { scale: 0.49; }
  28.21% {
    animation-timing-function: cubic-bezier(0.68, 0.004, 0.357, 0.993);
    scale: 0.49;
  }
  54.964% { scale: 1; }
  100% { scale: 1; }
}

.pa-fab-label {
  position: relative;
  z-index: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-8px);
  transition:
    opacity 0.45s cubic-bezier(0.34, 1.25, 0.64, 1) 0.06s,
    transform 0.55s cubic-bezier(0.34, 1.25, 0.64, 1) 0.04s;
}

.pa-fab:hover .pa-fab-label,
.pa-fab:focus-visible .pa-fab-label {
  opacity: 1;
  transform: translateX(0);
}

body.pa-modal-open .pa-fab {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
}

/* Bottom sheet — flush left / right / bottom, slides up like site covers */
.pa-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: flex-end;
  justify-content: stretch;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pa-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.pa-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 21, 17, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.pa-modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  max-height: min(92svh, 860px);
  transform: translateY(110%);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.pa-modal.is-open .pa-modal-dialog {
  transform: translateY(0);
}

.pa-card {
  display: flex;
  flex-direction: column;
  height: min(92svh, 860px);
  max-height: min(92svh, 860px);
  background: var(--paper, #f6f7f4);
  border: 1px solid rgba(17, 21, 17, 0.1);
  border-bottom: none;
  border-radius: 44px 44px 0 0;
  box-shadow: 0 -18px 48px rgba(17, 21, 17, 0.14);
  overflow: hidden;
}

.pa-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem clamp(1.25rem, 4vw, 2rem) 1.15rem;
  border-bottom: 1px solid rgba(15, 14, 12, 0.08);
  background: rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
}

.pa-card-heading {
  min-width: 0;
}

.pa-card-title {
  font-family: var(--font-display, var(--serif));
  font-stretch: 82%;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

.pa-card-caption {
  font-family: var(--font-body, var(--sans));
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-3, var(--mid));
}

.pa-header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.pa-speaker,
.pa-modal-close {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.2s, transform 0.2s, background 0.2s, color 0.2s;
}

.pa-speaker:hover,
.pa-modal-close:hover {
  border-color: rgba(46, 204, 113, 0.55);
  background: var(--ink);
  color: var(--green, #2ecc71);
  transform: scale(1.05);
}

.pa-speaker[aria-pressed="true"] {
  border-color: rgba(46, 204, 113, 0.45);
  background: rgba(46, 204, 113, 0.16);
  color: var(--ink);
}

.pa-speaker[aria-pressed="true"]:hover {
  background: var(--ink);
  color: var(--green, #2ecc71);
}

.pa-speaker-icon {
  display: block;
}

.pa-modal-close {
  font-size: 1.1rem;
}

.pa-messages {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 1.35rem clamp(1.25rem, 4vw, 2rem) 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  scroll-behavior: smooth;
}

.pa-messages::-webkit-scrollbar {
  width: 6px;
}

.pa-messages::-webkit-scrollbar-thumb {
  background: rgba(15, 14, 12, 0.12);
  border-radius: 999px;
}

.pa-message {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  opacity: 0;
  transform: translateY(8px);
  animation: paMessageIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.pa-message--user {
  align-items: flex-end;
}

.pa-bubble {
  max-width: 90%;
  padding: 0.95rem 1.1rem;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

.pa-bubble--assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(15, 14, 12, 0.08);
  color: var(--ink);
}

.pa-bubble--user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
  border-radius: 16px 16px 4px 16px;
}

.pa-bubble a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(212, 65, 11, 0.35);
  transition: border-color 0.2s, color 0.2s;
}

.pa-bubble a:hover {
  border-color: var(--accent);
}

.pa-bubble strong {
  font-weight: 600;
}

.pa-bubble--typing::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: paCursorBlink 0.9s step-end infinite;
}

.pa-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-left: 0.1rem;
  opacity: 0;
  transform: translateY(6px);
  animation: paSuggestionsIn 0.5s 0.15s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.pa-suggestion {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 14, 12, 0.12);
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  transition:
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s;
}

.pa-suggestion:hover {
  transform: translateY(-2px);
  border-color: rgba(212, 65, 11, 0.35);
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 14, 12, 0.06);
}

.pa-input-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1rem clamp(1.25rem, 4vw, 2rem) calc(1.15rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(15, 14, 12, 0.08);
  background: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.pa-input {
  flex: 1;
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 14, 12, 0.12);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pa-input::placeholder {
  color: rgba(107, 101, 96, 0.72);
}

.pa-input:focus {
  border-color: rgba(46, 204, 113, 0.55);
  box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.14);
}

.pa-send {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: none;
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.pa-send:hover {
  transform: translateY(-1px);
  background: #2a2824;
}

.pa-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

body.pa-modal-open {
  overflow: hidden;
}

@keyframes paMessageIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes paSuggestionsIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes paCursorBlink {
  50% { opacity: 0; }
}

@media (max-width: 1024px) {
  .pa-fab {
    right: 1.25rem;
    bottom: 1.25rem;
  }

  .pa-modal-dialog,
  .pa-card {
    height: min(94svh, 900px);
    max-height: min(94svh, 900px);
  }

  .pa-card {
    border-radius: 32px 32px 0 0;
  }
}

@media (max-width: 640px) {
  .pa-fab {
    right: 1rem;
    bottom: 1rem;
  }

  .pa-fab-label {
    display: none;
  }

  .pa-modal-dialog,
  .pa-card {
    height: min(96svh, 100%);
    max-height: min(96svh, 100%);
  }

  .pa-card {
    border-radius: 28px 28px 0 0;
  }

  .pa-input-row {
    flex-direction: column;
    align-items: stretch;
  }

  .pa-send {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pa-fab,
  .pa-fab-icon,
  .pa-fab-star-wrap,
  .pa-fab-label,
  .pa-modal-dialog {
    transition: none;
  }

  .pa-fab-star-wrap {
    animation: none;
    translate: 0 0;
    scale: 1;
    rotate: 0deg;
  }

  .pa-message,
  .pa-suggestions {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .pa-bubble--typing::after {
    display: none;
  }
}
