/* "Ask the Woodland" chat widget — tokens from styles.css, prefix .wd- */

.wd-root { position: fixed; right: 22px; bottom: 22px; z-index: 60; font-family: var(--sans); }

.wd-launch {
  width: 66px; height: 66px; border-radius: 50%; border: 3px solid #fff; cursor: pointer;
  background: var(--cream); padding: 0; overflow: visible; position: relative;
  box-shadow: 0 12px 28px -10px rgba(74,48,20,.6); transition: transform .18s ease;
}
.wd-launch img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.wd-launch:hover { transform: translateY(-3px) scale(1.03); }
.wd-launch::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(217,138,43,.5); opacity: 0; animation: wd-ring 3.2s ease-out infinite;
  pointer-events: none;
}
.wd-launch.has-unread::before {
  content: ""; position: absolute; top: 2px; right: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--amber); border: 2px solid #fff; z-index: 1;
}
@keyframes wd-ring { 0%{opacity:.6;inset:-3px} 70%{opacity:0;inset:-12px} 100%{opacity:0} }

.wd-teaser {
  position: absolute; right: 80px; bottom: 6px; width: max-content; max-width: 250px;
  background: var(--cream); border: 1px solid var(--line); border-radius: 16px 16px 4px 16px;
  padding: 12px 14px 12px 14px; box-shadow: 0 14px 30px -14px rgba(74,48,20,.5);
  display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  transition: opacity .6s ease, transform .6s ease;
}
.wd-teaser.wd-hide { opacity: 0; transform: translateY(8px) scale(.97); }
.wd-teaser.wd-dismissed { display: none; }
.wd-teaser::after {
  content: ""; position: absolute; right: -6px; bottom: 14px; width: 12px; height: 12px;
  background: var(--cream); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: rotate(-45deg);
}
.wd-teaser img { width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto; margin-top: 1px; }
.wd-teaser .t-body { flex: 1; min-width: 0; padding-right: 18px; }
.wd-teaser .t-name { font-weight: 800; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--amber-deep); margin: 0 0 2px; }
.wd-teaser .t-text { font-size: .92rem; line-height: 1.4; color: var(--ink); margin: 0; }
.wd-teaser .t-hint { font-size: .74rem; color: var(--ink-faint); margin: 4px 0 0; }
.wd-teaser .t-dismiss {
  position: absolute; top: 6px; right: 8px; z-index: 2; background: none; border: 0; font-size: 1.1rem;
  line-height: 1; color: var(--ink-faint); cursor: pointer; padding: 2px 4px; border-radius: 6px;
}
.wd-teaser .t-dismiss:hover { color: var(--ink); background: var(--parchment-2); }

.wd-panel {
  position: absolute; right: 0; bottom: 82px; width: 380px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 120px);
  background: var(--parchment); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 30px 70px -24px rgba(74,48,20,.65); display: none; flex-direction: column; overflow: hidden;
}
.wd-root.open .wd-panel { display: flex; }
.wd-root.open .wd-teaser { display: none !important; }

.wd-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px;
  background: var(--cream); border-bottom: 1px solid var(--line);
}
.wd-head .h-badge { width: 40px; height: 40px; border-radius: 50%; }
.wd-head .h-title { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; color: var(--ink); line-height: 1; }
.wd-head .h-sub { font-size: .82rem; color: var(--ink-faint); margin-top: 3px; }
.wd-head .h-close {
  margin-left: auto; background: none; border: 0; font-size: 1.5rem; color: var(--ink-faint);
  cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 8px;
}
.wd-head .h-close:hover { color: var(--ink); background: var(--parchment-2); }

.wd-thread {
  flex: 1; overflow-y: auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 16px;
}

.wd-msg { display: flex; gap: 10px; align-items: flex-start; max-width: 92%; }
.wd-msg img { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; filter: drop-shadow(0 3px 5px rgba(74,48,20,.25)); }
.wd-bubble { background: var(--cream); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 11px 14px; box-shadow: var(--shadow-soft); }
.wd-bubble .b-name { font-family: var(--serif); font-weight: 600; font-size: .92rem; color: var(--amber-deep); margin: 0 0 3px; }
.wd-bubble .b-text { font-size: .96rem; line-height: 1.55; color: var(--ink); margin: 0; white-space: pre-wrap; }

.wd-msg.me { align-self: flex-end; max-width: 84%; }
.wd-msg.me .wd-bubble { background: var(--teal); border-color: var(--teal-deep); border-radius: 16px 16px 4px 16px; }
.wd-msg.me .b-text { color: #f4efe2; }

.wd-typing { display: flex; gap: 10px; align-items: center; }
.wd-typing img { width: 34px; height: 34px; border-radius: 50%; }
.wd-dots {
  background: var(--cream); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px;
  padding: 12px 14px; display: flex; gap: 5px;
}
.wd-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); opacity: .5; animation: wd-blink 1.2s infinite; }
.wd-dots span:nth-child(2) { animation-delay: .2s; }
.wd-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes wd-blink { 0%,60%,100%{opacity:.3} 30%{opacity:.9} }

.wd-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.wd-chips.hidden { display: none; }
.wd-chip {
  font-size: .85rem; font-weight: 700; color: var(--teal-deep); background: var(--cream);
  border: 1px solid var(--teal); border-radius: 999px; padding: 7px 13px; cursor: pointer;
}
.wd-chip:hover { background: var(--teal); color: #fff; }

.wd-input {
  display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--cream);
}
.wd-input input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 999px; padding: 11px 15px;
  font-family: var(--sans); font-size: .95rem; background: var(--parchment); color: var(--ink);
}
.wd-input input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47,111,107,.18); }
.wd-input input:disabled { opacity: .65; }
.wd-input button {
  flex: 0 0 auto; border: 0; border-radius: 999px; background: var(--amber); color: #fff;
  font-weight: 800; padding: 0 18px; cursor: pointer;
}
.wd-input button:hover:not(:disabled) { background: var(--amber-deep); }
.wd-input button:disabled { opacity: .55; cursor: not-allowed; }

.wd-foot { text-align: center; font-size: .72rem; color: var(--ink-faint); padding: 0 0 10px; background: var(--cream); }
.wd-turnstile { display: none; padding: 0 14px 8px; background: var(--cream); }
.wd-turnstile.visible { display: block; }

.wd-error .wd-bubble { border-color: var(--amber-deep); }

@media (max-width: 640px) {
  .wd-panel { width: calc(100vw - 24px); height: calc(100vh - 96px); bottom: 82px; }
  .wd-teaser { max-width: 200px; }
}

@media (prefers-reduced-motion: reduce) {
  .wd-teaser { transition: none; }
  .wd-launch::after { animation: none; opacity: 0; }
  .wd-dots span { animation: none; opacity: .5; }
  .wd-root:not(.open):not(.has-chatted) .wd-teaser.wd-dismissed { display: none; }
  .wd-root:not(.open):not(.has-chatted) .wd-launch:hover + .wd-teaser.wd-dismissed,
  .wd-root:not(.open):not(.has-chatted) .wd-launch:focus + .wd-teaser.wd-dismissed {
    display: flex;
  }
}
