/* Standalone contact widget. Colors follow the supplied dark chat reference.
   The provided screenshot is unchanged; background positioning shows only
   its avatar. Replace this rule with a full-size portrait when available. */
.contact-widget {
  --contact-bg: #111110;
  --contact-surface: #222221;
  --contact-border: #323231;
  --contact-text: #f6f6f5;
  --contact-muted: #a7a7a3;
  --contact-accent: #ef805e;
  --contact-right: max(var(--gutter, 80px), env(safe-area-inset-right));
  --contact-bottom: max(24px, env(safe-area-inset-bottom));
  font-family: Pretendard, var(--font-family-body), sans-serif;
  letter-spacing: -0.004em;
  color: var(--contact-text);
  position: relative;
  z-index: 1000;
}
.contact-widget button, .contact-widget input, .contact-widget select, .contact-widget textarea {
  font: inherit;
  letter-spacing: inherit;
}
.contact-widget button, .contact-widget a, .contact-widget input, .contact-widget select, .contact-widget textarea {
  -webkit-tap-highlight-color: transparent;
}
.contact-widget button {
  cursor: pointer;
}
.contact-widget button:focus-visible, .contact-widget a:focus-visible, .contact-widget input:focus-visible, .contact-widget select:focus-visible, .contact-widget textarea:focus-visible {
  outline: 2px solid var(--contact-accent);
  outline-offset: 3px;
}
.contact-widget svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.contact-avatar {
  --avatar-size: 56px;
  width: var(--avatar-size);
  height: var(--avatar-size);
  flex: 0 0 var(--avatar-size);
  border-radius: 50%;
  overflow: hidden;
  display: block;
  background-color: #141413;
  background-image: url("../images/avatar.png");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}

.contact-launcher {
  position: fixed;
  right: var(--contact-right);
  bottom: var(--contact-bottom);
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  padding: 5px;
  border: 2px solid var(--contact-accent);
  border-radius: 50%;
  background: #161615;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 5px rgba(239, 128, 94, 0.0823529412);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.contact-launcher .contact-avatar {
  --avatar-size: 60px;
}
.contact-launcher:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 0 6px rgba(239, 128, 94, 0.1333333333);
}
.contact-launcher[aria-expanded=true] .contact-launcher-label {
  opacity: 0;
  transform: translateX(8px);
  visibility: hidden;
}

.contact-launcher-label {
  position: absolute;
  right: calc(100% + 14px);
  top: 50%;
  margin-top: -21px;
  white-space: nowrap;
  background: #222221;
  color: #f6f6f5;
  border: 1px solid #41413e;
  padding: 9px 16px;
  border-radius: 12px 12px 0 12px;
  font-size: 14px;
  line-height: 22px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  transition: opacity 0.2s, transform 0.2s;
}

.contact-availability {
  position: absolute;
  bottom: 7px;
  right: 3px;
  width: 15px;
  height: 15px;
  background: #2bd39a;
  border: 3px solid #151514;
  border-radius: 50%;
}

.contact-panel {
  position: fixed;
  right: var(--contact-right);
  bottom: calc(var(--contact-bottom) + 94px);
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 650px;
  max-height: calc(100vh - 142px);
  max-height: calc(100dvh - 142px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--contact-border);
  border-radius: 28px;
  background: var(--contact-bg);
  color: var(--contact-text);
  color-scheme: dark;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4), 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: contact-open 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transform-origin: bottom right;
}
.contact-panel[hidden] {
  display: none;
}

.contact-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 17px 18px;
  border-bottom: 1px solid #2d2d2b;
}
.contact-header .contact-avatar {
  --avatar-size: 46px;
}

.contact-heading {
  min-width: 0;
  flex: 1;
}
.contact-heading h2 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.02em;
}
.contact-heading p {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--contact-muted);
  font-size: 12px;
  line-height: 1.5;
}
.contact-heading p span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2bd39a;
}

.contact-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-right: -6px;
  border: 0;
  border-radius: 50%;
  color: #aaa;
  background: transparent;
}
.contact-close:hover {
  background: #282827;
  color: white;
}

/* Outside the scrollable form: return navigation is always reachable. */
.contact-form-nav {
  display: flex;
  flex-shrink: 0;
  padding: 5px 12px;
  border-bottom: 1px solid #2d2d2b;
  background: var(--contact-bg);
}
.contact-form-nav[hidden] {
  display: none;
}
.contact-form-nav .contact-reset {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  color: var(--contact-text);
}
.contact-form-nav svg {
  width: 17px;
  height: 17px;
}

.contact-conversation {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.contact-conversation[hidden] {
  display: none;
}

.contact-messages, .contact-options, .contact-brief {
  scrollbar-width: thin;
  scrollbar-color: #565653 transparent;
  overscroll-behavior: contain;
}

.contact-messages {
  flex: 1;
  min-height: 80px;
  overflow-y: auto;
  padding: 20px 14px 16px;
  scroll-behavior: smooth;
}

.contact-message {
  width: fit-content;
  max-width: 88%;
  padding: 11px 15px;
  margin-bottom: 9px;
  border-radius: 6px 22px 22px 22px;
  border: 1px solid #2c2c29;
  background: #20201e;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.65;
  white-space: pre-line;
  overflow-wrap: anywhere;
  animation: contact-message 0.28s ease both;
}
.contact-message--user {
  margin-left: auto;
  border: 0;
  border-radius: 22px 6px 22px 22px;
  background: var(--contact-accent);
  color: #141413;
  font-weight: 600;
}

.contact-message-actions {
  display: grid;
  gap: 7px;
  margin: 3px 0 13px;
}

.contact-action, .contact-option {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 15px;
  border: 1px solid #373734;
  border-radius: 25px;
  background: #272725;
  color: var(--contact-text);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 550;
  text-align: left;
  overflow-wrap: anywhere;
  transition: background 0.18s, border-color 0.18s;
}
.contact-action:hover, .contact-option:hover {
  background: #333330;
  border-color: #57574f;
}
.contact-action svg, .contact-option svg {
  width: 17px;
  height: 17px;
}

.contact-suggestions {
  flex-shrink: 0;
  border-top: 1px solid #2d2d2b;
  padding: 9px 11px 4px;
}

.contact-options {
  max-height: 198px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
  padding: 1px 3px;
}

.contact-option {
  background: #222221;
  padding-block: 11px;
}

.contact-reset {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 13px;
  background: transparent;
  border: 0;
  font-size: 13px;
  color: var(--contact-muted);
}
.contact-reset:hover {
  color: #fff;
}

.contact-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 10px 11px;
  border-top: 1px solid #2d2d2b;
}
.contact-composer input {
  display: block;
  width: 0;
  flex: 1;
  height: 43px;
  border-radius: 24px;
  padding: 10px 15px;
  border: 1px solid #343431;
  background: #222221;
  color: var(--contact-text);
  font-size: 14px;
  outline-offset: 0;
}
.contact-composer input::placeholder {
  color: #97978f;
}

.contact-send {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--contact-accent);
  color: #161615;
  border: 0;
  transition: opacity 0.2s;
}
.contact-send:disabled {
  opacity: 0.4;
  cursor: default;
}

.contact-brief {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 14px 18px 20px;
}
.contact-brief[hidden] {
  display: none;
}

.contact-brief-top {
  margin-bottom: 20px;
}
.contact-brief-top .contact-reset {
  padding-left: 0;
  margin-bottom: 8px;
}
.contact-brief-top h3 {
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.3;
}
.contact-brief-top p {
  margin-top: 9px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--contact-muted);
}

.contact-brief-form {
  display: grid;
  gap: 15px;
}
.contact-brief-form label {
  min-width: 0;
  display: grid;
  gap: 7px;
  font-size: 13px;
  line-height: 1.5;
  color: #dadad6;
}
.contact-brief-form label > span {
  display: contents;
  color: var(--contact-accent);
}
.contact-brief-form input, .contact-brief-form select, .contact-brief-form textarea {
  min-width: 0;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #3a3a35;
  border-radius: 10px;
  background: #222221;
  color: var(--contact-text);
  font-size: 14px;
  line-height: 1.5;
}
.contact-brief-form textarea {
  resize: vertical;
  min-height: 100px;
}
.contact-brief-form input::placeholder, .contact-brief-form textarea::placeholder {
  color: #94948c;
}

.contact-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.contact-form-note {
  font-size: 12px;
  color: var(--contact-muted);
  line-height: 1.65;
}

.contact-primary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  border-radius: 24px;
  padding: 12px 18px;
  background: var(--contact-accent);
  color: #171713;
  border: 0;
  font-size: 14px;
  font-weight: 650;
}
.contact-primary:hover {
  background: #ff9474;
}

.contact-copy {
  background: transparent;
  color: #d4d4cb;
  border: 1px solid #41413b;
  border-radius: 24px;
  min-height: 44px;
  font-size: 14px;
}

.contact-form-result {
  font-size: 13px;
  line-height: 1.6;
  color: #e6ba9f;
}
.contact-form-result:empty {
  display: none;
}

.contact-nojs {
  position: fixed;
  z-index: 1001;
  right: 24px;
  bottom: 24px;
  border-radius: 24px;
  background: #ef805e;
  color: #171713;
  padding: 14px 20px;
  font-size: 14px;
}

@keyframes contact-open {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes contact-message {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 767px) {
  .contact-widget {
    --contact-right: max(16px, env(safe-area-inset-right));
    --contact-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .contact-launcher {
    width: 66px;
    height: 66px;
  }
  .contact-launcher .contact-avatar {
    --avatar-size: 52px;
  }
  .contact-panel {
    width: calc(100vw - 32px);
    max-width: none;
    bottom: calc(var(--contact-bottom) + 80px);
    height: 650px;
    max-height: calc(100dvh - var(--contact-bottom) - 92px);
    border-radius: 24px;
  }
  .contact-header {
    min-height: 80px;
    padding: 13px 14px;
    gap: 9px;
  }
  .contact-heading h2 {
    font-size: 15px;
  }
  .contact-options {
    max-height: 154px;
  }
  .contact-composer input, .contact-brief-form input, .contact-brief-form select, .contact-brief-form textarea {
    font-size: 16px;
  }
}
@media (max-height: 600px) {
  .contact-panel {
    bottom: 12px;
    top: 12px;
    height: auto;
    max-height: none;
  }
  .contact-launcher[aria-expanded=true] {
    visibility: hidden;
  }
  .contact-options {
    max-height: 108px;
  }
  .contact-header {
    min-height: 72px;
    padding-block: 10px;
  }
}
@media (max-width: 390px) {
  .contact-form-row {
    grid-template-columns: 1fr;
  }
}
@media (max-height: 520px) {
  .contact-header {
    min-height: 64px;
    padding-block: 8px;
  }
  .contact-header .contact-avatar {
    --avatar-size: 38px;
  }
  .contact-options {
    max-height: 52px;
  }
  .contact-messages {
    min-height: 48px;
    padding-block: 12px;
  }
  .contact-reset {
    min-height: 28px;
    padding-block: 3px;
  }
}
@media (max-height: 360px) {
  .contact-suggestions {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .contact-widget *, .contact-widget *::before, .contact-widget *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
