/* Stud Building — Site Chat B · premium trade desk */
:root {
  --sc-bg: #f7f5f0;
  --sc-surface: #ffffff;
  --sc-ink: #1a1916;
  --sc-muted: #6b6760;
  --sc-line: rgba(26, 25, 22, 0.1);
  --sc-line-strong: rgba(26, 25, 22, 0.16);
  --sc-accent: #1f4ed8;
  --sc-accent-hover: #1639a8;
  --sc-shadow: 0 24px 64px -16px rgba(26, 25, 22, 0.28), 0 8px 24px -8px rgba(26, 25, 22, 0.12);
  --sc-radius: 16px;
  --sc-radius-sm: 10px;
  --sc-actionbar: 88px;
  --sc-z: 200;
  --sc-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --sc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

.sc-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--sc-z);
  font-family: var(--sc-font);
  color: var(--sc-ink);
  -webkit-font-smoothing: antialiased;
}

.sc-fab {
  pointer-events: auto;
  position: fixed;
  right: 16px;
  bottom: calc(var(--sc-actionbar) + env(safe-area-inset-bottom, 0px));
  height: 48px;
  min-height: 48px;
  min-width: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--sc-ink);
  background: var(--sc-ink);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 8px 24px -8px rgba(26, 25, 22, 0.45);
  cursor: pointer;
  z-index: var(--sc-z);
  font-family: var(--sc-font);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background 0.22s ease, transform 0.18s var(--sc-ease), box-shadow 0.22s ease;
}
.sc-fab:hover,
.sc-fab:focus-visible {
  background: var(--sc-accent);
  border-color: var(--sc-accent);
  outline: none;
}
.sc-fab:active { transform: scale(0.97); }
.sc-fab[aria-expanded="true"] {
  background: var(--sc-ink);
  border-color: var(--sc-ink);
}
.sc-fab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}
.sc-fab .sc-fab-label { line-height: 1; }
.sc-fab .sc-fab-x {
  display: none;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 300;
}
.sc-fab[aria-expanded="true"] .sc-fab-open { display: none; }
.sc-fab[aria-expanded="true"] .sc-fab-x { display: block; }

.sc-scrim {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 25, 22, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.28s var(--sc-ease);
  z-index: calc(var(--sc-z) - 1);
}
.sc-scrim.is-on {
  pointer-events: auto;
  opacity: 1;
}

.sc-panel {
  pointer-events: auto;
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(400px, calc(100vw - 24px));
  background: var(--sc-surface);
  border: 1px solid var(--sc-line-strong);
  border-radius: var(--sc-radius);
  box-shadow: var(--sc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: var(--sc-z);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(16px) scale(0.98);
  transition:
    opacity 0.28s var(--sc-ease),
    transform 0.32s var(--sc-ease),
    visibility 0.32s;
}
.sc-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}

.sc-handle {
  display: none;
  width: 36px;
  height: 4px;
  border-radius: 99px;
  background: var(--sc-line-strong);
  margin: 10px auto 0;
  flex-shrink: 0;
}

.sc-hd {
  background: var(--sc-surface);
  border-bottom: 1px solid var(--sc-line);
  padding: 18px 20px 14px;
  flex-shrink: 0;
}
.sc-hd-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.sc-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sc-accent);
  margin-bottom: 6px;
}
.sc-n {
  font-weight: 650;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--sc-ink);
}
.sc-s {
  margin-top: 6px;
  font-size: 0.875rem;
  color: var(--sc-muted);
  line-height: 1.4;
  max-width: 30ch;
}
.sc-close {
  background: var(--sc-bg);
  border: 1px solid var(--sc-line);
  color: var(--sc-ink);
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.sc-close:hover,
.sc-close:focus-visible {
  background: var(--sc-ink);
  color: #fff;
  border-color: var(--sc-ink);
  outline: none;
}

.sc-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}
.sc-chip {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--sc-muted);
  background: var(--sc-bg);
  border: 1px solid var(--sc-line);
  padding: 6px 10px;
  border-radius: 999px;
}

.sc-msgs {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 20px;
  background: var(--sc-bg);
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.sc-b {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.9375rem;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.sc-bot {
  background: var(--sc-surface);
  color: var(--sc-ink);
  align-self: flex-start;
  border: 1px solid var(--sc-line);
  border-bottom-left-radius: 4px;
}
.sc-me {
  background: var(--sc-ink);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.sc-err {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid rgba(154, 52, 18, 0.2);
  align-self: stretch;
  max-width: 100%;
  font-size: 0.875rem;
}
.sc-typing {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--sc-muted);
  padding: 4px 2px;
}

.sc-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px 0;
  background: var(--sc-bg);
  flex-shrink: 0;
}
.sc-quick button {
  font-family: var(--sc-font);
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--sc-ink);
  background: var(--sc-surface);
  border: 1px solid var(--sc-line-strong);
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.sc-quick button:hover,
.sc-quick button:focus-visible {
  background: var(--sc-ink);
  color: #fff;
  border-color: var(--sc-ink);
  outline: none;
}
.sc-quick.is-hidden { display: none; }

.sc-composer {
  display: flex;
  gap: 8px;
  padding: 14px 16px 12px;
  border-top: 1px solid var(--sc-line);
  background: var(--sc-surface);
  flex-shrink: 0;
}
.sc-composer input {
  flex: 1;
  border: 1px solid var(--sc-line-strong);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: var(--sc-font);
  color: var(--sc-ink);
  background: var(--sc-bg);
  min-width: 0;
  min-height: 48px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.sc-composer input::placeholder { color: var(--sc-muted); }
.sc-composer input:focus {
  outline: none;
  border-color: var(--sc-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 78, 216, 0.18);
}
.sc-composer button[type="submit"] {
  background: var(--sc-accent);
  color: #fff;
  border: 1px solid var(--sc-accent);
  border-radius: 12px;
  padding: 0 18px;
  min-height: 48px;
  min-width: 72px;
  font-family: var(--sc-font);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
}
.sc-composer button[type="submit"]:hover:not(:disabled),
.sc-composer button[type="submit"]:focus-visible:not(:disabled) {
  background: var(--sc-accent-hover);
  border-color: var(--sc-accent-hover);
  outline: none;
}
.sc-composer button[type="submit"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sc-composer button[type="submit"]:active:not(:disabled) { transform: scale(0.97); }

.sc-foot {
  flex-shrink: 0;
  padding: 12px 20px 14px;
  border-top: 1px solid var(--sc-line);
  background: var(--sc-bg);
  font-size: 0.75rem;
  color: var(--sc-muted);
  line-height: 1.5;
  text-align: left;
}
.sc-foot a {
  color: var(--sc-accent);
  font-weight: 600;
  text-decoration: none;
}
.sc-foot a:hover { text-decoration: underline; }

@media (min-width: 768px) {
  .sc-fab {
    bottom: 24px;
    right: 24px;
  }
  .sc-scrim.is-on { background: rgba(26, 25, 22, 0.28); }
  /* Clear sticky #top (nav + ruler ~89px) so header is never clipped under site nav */
  .sc-panel {
    top: calc(var(--nav-h, 62px) + var(--ruler-h, 27px) + 10px);
    bottom: 16px;
    right: 16px;
  }
}

@media (max-width: 767px) {
  .sc-fab {
    right: 12px;
    padding: 0 16px;
    bottom: calc(var(--sc-actionbar) + 8px + env(safe-area-inset-bottom, 0px));
  }
  .sc-panel {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: min(92vh, calc(100vh - env(safe-area-inset-top, 0px) - 24px));
    border-radius: 20px 20px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    transform: translateY(110%);
  }
  .sc-panel.is-open {
    transform: translateY(0);
  }
  .sc-handle { display: block; }
  .sc-callstrip {
    pointer-events: auto;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(44px + env(safe-area-inset-bottom, 0px));
    padding: 0 16px env(safe-area-inset-bottom, 0px);
    background: var(--sc-ink);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: space-between;
    font-family: var(--sc-font);
    font-size: 0.75rem;
    font-weight: 600;
    z-index: var(--sc-z);
    text-decoration: none;
  }
  .sc-callstrip.is-on { display: flex; }
  .sc-callstrip span:last-child { opacity: 0.85; }
}

@media (min-width: 768px) {
  .sc-callstrip { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .sc-fab, .sc-panel, .sc-scrim, .sc-composer button, .sc-quick button, .sc-close {
    transition: none !important;
  }
}

html.sc-desk-open { overflow: hidden; }
