/* CLAUDE 11-03: the help bubble and its panel (web/supportchat.js). Graphite: neutral surfaces, white primary action,
   no green (nothing here is a state). Shown on the landing and the home pages, never over the editor. */
.sc-fab {
  position: fixed;
  right: max(var(--s-4), env(safe-area-inset-right));
  bottom: max(var(--s-4), env(safe-area-inset-bottom));
  z-index: 70;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--c-primary);
  color: var(--c-primary-ink);
  box-shadow: var(--e-float);
  cursor: pointer;
  transition:
    transform var(--d-press) var(--ease-out),
    background var(--d-hover) var(--ease-out);
}
.sc-fab:hover {
  background: var(--c-primary-hover);
}
.sc-fab:active {
  transform: scale(0.94);
}
.sc-fab:focus-visible,
.sc-panel :focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}
.sc-fab .sc-ic {
  width: 24px;
  height: 24px;
}
.sc-panel .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.sc-ic {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sc-fab .sc-ic path {
  fill: currentColor;
  stroke: none;
}
body:not(.at-home) .sc-fab,
body:not(.at-home) .sc-panel,
body.pe-on .sc-fab,
body.pe-on .sc-panel,
body.sheet-open .sc-fab {
  display: none;
}
body.sc-open .sc-fab {
  display: none;
}

.sc-panel {
  position: fixed;
  right: max(var(--s-4), env(safe-area-inset-right));
  bottom: max(var(--s-4), env(safe-area-inset-bottom));
  z-index: 71;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 2 * var(--s-4)));
  height: min(600px, calc(100dvh - 2 * var(--s-6)));
  background: var(--c-surface);
  color: var(--c-fg);
  border-radius: var(--r-lg);
  box-shadow: var(--e-float);
  overflow: hidden;
  transform-origin: bottom right;
  animation: sc-in var(--d-panel) var(--ease-out);
}
.sc-panel[hidden] {
  display: none;
}
@keyframes sc-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}
.sc-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-4) var(--s-3);
  border-bottom: 1px solid var(--c-line);
}
.sc-titles {
  flex: 1;
  min-width: 0;
}
.sc-head h2 {
  margin: 0;
  font-size: var(--t-title);
  font-weight: 600;
}
.sc-sub {
  margin: 2px 0 0;
  font-size: var(--t-label);
  color: var(--c-fg-3);
}
.sc-x {
  display: grid;
  place-items: center;
  width: var(--h-md);
  height: var(--h-md);
  margin: -4px -6px 0 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--c-fg-2);
  cursor: pointer;
}
.sc-x:hover {
  background: var(--c-raised);
  color: var(--c-fg);
}

.sc-log {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  font-size: var(--t-body);
  line-height: 1.55;
}
.sc-log[hidden] {
  display: none;
}
.sc-hello {
  margin: 0 0 var(--s-3);
  color: var(--c-fg-2);
}
.sc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.sc-chip {
  min-height: var(--h-md);
  padding: 6px 12px;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--c-fg);
  font-size: var(--t-label);
  text-align: left;
  cursor: pointer;
  transition: background var(--d-hover) var(--ease-out);
}
.sc-chip:hover {
  background: var(--c-raised);
}
.sc-q {
  align-self: flex-end;
  max-width: 85%;
  margin: 0;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md) var(--r-md) var(--r-xs) var(--r-md);
  background: var(--c-raised);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.sc-a {
  max-width: 92%;
  overflow-wrap: anywhere;
}
.sc-a p {
  margin: 0 0 var(--s-1);
}
.sc-a.unknown > p:first-child {
  color: var(--c-fg-2);
}
.sc-src {
  font-size: var(--t-label);
  color: var(--c-fg-3);
}
.sc-src a {
  color: var(--c-fg-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sc-src a:hover {
  color: var(--c-fg);
}
.sc-rate {
  display: flex;
  gap: 2px;
  margin-top: 2px;
}
.sc-thumb {
  display: grid;
  place-items: center;
  width: var(--h-sm);
  height: var(--h-sm);
  padding: 0;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--c-fg-3);
  cursor: pointer;
}
.sc-thumb .sc-ic {
  width: 15px;
  height: 15px;
}
.sc-thumb.down .sc-ic {
  transform: rotate(180deg);
}
.sc-thumb:hover {
  color: var(--c-fg);
  background: var(--c-raised);
}
.sc-thumb[aria-pressed='true'] {
  color: var(--c-fg);
}
.sc-thumb[aria-pressed='true'] .sc-ic path {
  fill: currentColor;
  fill-opacity: 0.25;
}
.sc-mailcta,
.sc-primary,
.sc-secondary {
  min-height: var(--h-md);
  margin-top: var(--s-2);
  padding: 0 var(--s-4);
  border-radius: var(--r-pill);
  font-size: var(--t-label);
  font-weight: 600;
  cursor: pointer;
}
.sc-mailcta,
.sc-primary {
  border: 0;
  background: var(--c-primary);
  color: var(--c-primary-ink);
}
.sc-mailcta:hover,
.sc-primary:hover {
  background: var(--c-primary-hover);
}
.sc-primary:disabled {
  opacity: 0.5;
  cursor: default;
}
.sc-secondary {
  border: 1px solid var(--c-line-strong);
  background: transparent;
  color: var(--c-fg);
}
.sc-typing {
  display: flex;
  gap: 4px;
  padding: var(--s-2) 0;
}
.sc-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-fg-3);
  animation: sc-dot var(--d-skel) var(--ease-in-out) infinite;
}
.sc-typing i:nth-of-type(2) {
  animation-delay: 0.15s;
}
.sc-typing i:nth-of-type(3) {
  animation-delay: 0.3s;
}
@keyframes sc-dot {
  0%,
  80%,
  100% {
    opacity: 0.3;
  }
  40% {
    opacity: 1;
  }
}

.sc-form {
  display: flex;
  align-items: flex-end;
  gap: var(--s-2);
  margin: 0 var(--s-3);
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3);
  border-radius: var(--r-field);
  background: var(--c-raised);
}
.sc-form[hidden] {
  display: none;
}
.sc-input {
  flex: 1;
  min-height: 24px;
  max-height: 120px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--c-fg);
  font-size: var(--t-body);
  line-height: 1.45;
  resize: none;
  outline: none;
}
.sc-input::placeholder {
  color: var(--c-fg-3);
}
.sc-send {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--h-md);
  height: var(--h-md);
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--c-primary);
  color: var(--c-primary-ink);
  cursor: pointer;
}
.sc-send:disabled {
  background: var(--c-overlay);
  color: var(--c-fg-3);
  cursor: default;
}
.sc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-4) var(--s-3);
  font-size: var(--t-meta);
  color: var(--c-fg-3);
}
.sc-link {
  flex: none;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--c-fg-2);
  font-size: var(--t-label);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.sc-link:hover {
  color: var(--c-fg);
}

.sc-mail {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-4);
  font-size: var(--t-body);
  line-height: 1.55;
}
.sc-mail[hidden] {
  display: none;
}
.sc-mail h3 {
  margin: 0 0 var(--s-2);
  font-size: var(--t-title);
  font-weight: 600;
}
.sc-what {
  margin: 0 0 var(--s-3);
  color: var(--c-fg-2);
}
.sc-mailform label {
  display: grid;
  gap: var(--s-1);
  margin-bottom: var(--s-3);
  font-size: var(--t-label);
  color: var(--c-fg-2);
}
.sc-mailform input,
.sc-mailform textarea {
  width: 100%;
  box-sizing: border-box;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-field);
  background: var(--c-raised);
  color: var(--c-fg);
  font-size: var(--t-body);
  resize: vertical;
}
.sc-row {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
}
.sc-err {
  min-height: 1em;
  margin: 0 0 var(--s-1);
  font-size: var(--t-label);
  color: var(--c-danger);
}
.sc-err:empty {
  display: none;
}
.sc-done {
  margin: 0 0 var(--s-2);
}

/* the phone: above the floating tab bar, and the panel as a sheet from the bottom */
@media (max-width: 767.98px) {
  .sc-fab {
    bottom: calc(var(--tabs-h, 0px) + var(--s-3));
    width: 48px;
    height: 48px;
  }
  .sc-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: min(88dvh, 640px);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    transform-origin: bottom center;
  }
  .sc-input,
  .sc-mailform input,
  .sc-mailform textarea {
    font-size: var(--t-input); /* under 16 px iOS zooms the page on focus */
  }
  .sc-x {
    width: var(--h-touch);
    height: var(--h-touch);
  }
  .sc-chip,
  .sc-mailcta,
  .sc-primary,
  .sc-secondary {
    min-height: var(--h-touch);
  }
}
@media (prefers-reduced-motion: reduce) {
  .sc-panel,
  .sc-typing i {
    animation: none;
  }
  .sc-fab {
    transition: none;
  }
}
