/* Nest Neighbour: AI chat widget
   Forest #14372A · Pine #1F4A38 · Cream #FBF6EC · Oat #F1E6D2 · Honey #E9A23B (with Forest text) */
.nn-chat{
  --c-forest:#14372A; --c-pine:#1F4A38; --c-cream:#FBF6EC; --c-oat:#F1E6D2; --c-honey:#E9A23B; --c-ink:#17271F; --c-muted:#4A5A50;
  position:fixed; right:max(20px, env(safe-area-inset-right)); bottom:max(20px, env(safe-area-inset-bottom));
  z-index:90; font-family:"DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  display:flex; flex-direction:column; align-items:flex-end; gap:14px; pointer-events:none;
}
.nn-chat > *{pointer-events:auto}
.nn-chat .sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.nn-chat-ico{display:inline-flex;line-height:0}
.nn-chat-ico svg{width:100%;height:100%}

/* Launcher */
.nn-chat-launcher{
  display:inline-flex; align-items:center; gap:10px; min-height:58px; padding:0 22px 0 16px;
  border:2px solid rgba(251,246,236,.18); border-radius:999px; cursor:pointer;
  background:var(--c-forest); color:var(--c-cream); font-family:inherit; font-size:1rem; font-weight:700; line-height:1;
  box-shadow:0 16px 36px -14px rgba(20,55,42,.7), 0 2px 6px rgba(20,55,42,.25);
  transition:transform .2s ease, background-color .2s ease;
}
.nn-chat-launcher:hover{background:var(--c-pine); transform:translateY(-2px)}
.nn-chat-launcher .nn-chat-ico{width:28px;height:28px}
.nn-chat-launcher svg path{fill:var(--c-honey)}
.nn-chat-launcher svg circle{fill:var(--c-forest)}
.nn-chat-launcher:focus-visible,.nn-chat-close:focus-visible,.nn-chat-chip:focus-visible,.nn-chat-send:focus-visible,.nn-chat-cta:focus-visible,.nn-chat-note a:focus-visible,.nn-chat-log:focus-visible{
  outline:3px solid var(--c-honey); outline-offset:3px;
}
.nn-chat.is-open .nn-chat-launcher{padding:0; width:58px; justify-content:center}
.nn-chat.is-open .nn-chat-launcher-label{display:none}

/* Panel */
.nn-chat-panel{
  width:min(380px, calc(100vw - 40px)); height:min(600px, calc(100vh - 120px)); height:min(600px, calc(100dvh - 120px));
  display:flex; flex-direction:column; overflow:hidden;
  background:var(--c-cream); color:var(--c-ink); border-radius:22px;
  border:1px solid rgba(20,55,42,.14);
  box-shadow:0 30px 70px -24px rgba(20,55,42,.55), 0 4px 14px rgba(20,55,42,.14);
  transform-origin:bottom right; opacity:0; transform:translateY(12px) scale(.98);
  transition:opacity .18s ease, transform .18s ease;
}
.nn-chat-panel[hidden]{display:none}
.nn-chat-panel.is-visible{opacity:1; transform:none}

.nn-chat-head{display:flex; align-items:center; gap:12px; padding:14px 12px 14px 16px; background:var(--c-forest); color:var(--c-cream)}
.nn-chat-avatar{flex:none; width:42px; height:42px; border-radius:50%; background:var(--c-cream); color:var(--c-forest); display:grid; place-items:center}
.nn-chat-avatar .nn-chat-ico{width:30px;height:30px}
.nn-chat-heading{flex:1; min-width:0}
.nn-chat-title{margin:0; font-family:"Fraunces", Georgia, serif; font-weight:500; font-size:1.2rem; line-height:1.15; letter-spacing:-.01em; color:var(--c-cream)}
.nn-chat-sub{margin:2px 0 0; font-size:.8rem; color:rgba(251,246,236,.78)}
.nn-chat-close{flex:none; width:44px; height:44px; border-radius:50%; border:0; cursor:pointer; background:transparent; color:var(--c-cream); display:grid; place-items:center}
.nn-chat-close:hover{background:rgba(251,246,236,.12)}
.nn-chat-close .nn-chat-ico{width:22px;height:22px}
.nn-chat-close svg path{fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round}

.nn-chat-log{flex:1; overflow-y:auto; overscroll-behavior:contain; padding:16px 14px 8px; display:flex; flex-direction:column; gap:10px; scroll-behavior:smooth}
.nn-chat-msg{display:flex; flex-direction:column; max-width:88%}
.nn-chat-bot{align-self:flex-start; align-items:flex-start}
.nn-chat-user{align-self:flex-end; align-items:flex-end}
.nn-chat-bubble{padding:10px 14px; border-radius:18px; font-size:.95rem; line-height:1.5; overflow-wrap:anywhere}
.nn-chat-bubble p{margin:0}
.nn-chat-bubble p + p{margin-top:.5em}
.nn-chat-bot .nn-chat-bubble{background:var(--c-oat); color:var(--c-ink); border-bottom-left-radius:6px}
.nn-chat-user .nn-chat-bubble{background:var(--c-pine); color:var(--c-cream); border-bottom-right-radius:6px}
.nn-chat-msg.is-error .nn-chat-bubble{background:#FFF1DC; border:1px solid rgba(233,162,59,.55)}
.nn-chat-cta{
  margin-top:8px; display:inline-flex; align-items:center; min-height:40px; padding:.45em 1.05em; border-radius:999px;
  background:var(--c-honey); color:var(--c-forest); font-weight:700; font-size:.9rem; text-decoration:none;
}
.nn-chat-cta:hover{background:#F0B252}
.nn-chat-cta::after{content:"→"; margin-left:.45em}

.nn-chat-typing .nn-chat-bubble{display:flex; gap:5px; padding:14px 16px}
.nn-chat-typing i{width:7px; height:7px; border-radius:50%; background:var(--c-pine); opacity:.35; animation:nnDot 1.1s infinite ease-in-out}
.nn-chat-typing i:nth-of-type(2){animation-delay:.15s}
.nn-chat-typing i:nth-of-type(3){animation-delay:.3s}
@keyframes nnDot{0%,80%,100%{opacity:.25; transform:translateY(0)} 40%{opacity:.9; transform:translateY(-3px)}}

.nn-chat-chips{display:flex; flex-wrap:wrap; gap:8px; padding:4px 14px 12px}
.nn-chat-chips[hidden]{display:none}
.nn-chat-chip{
  min-height:38px; padding:.4em .95em; border-radius:999px; cursor:pointer; font-family:inherit; font-size:.88rem; font-weight:600; line-height:1.2; text-align:left;
  background:#fff; color:var(--c-forest); border:1.5px solid rgba(20,55,42,.28);
  transition:background-color .15s ease, border-color .15s ease;
}
.nn-chat-chip:hover{background:var(--c-oat); border-color:var(--c-pine)}
.nn-chat-chip:disabled{opacity:.55; cursor:default}

.nn-chat-foot{padding:10px 12px 12px; border-top:1px solid rgba(20,55,42,.12); background:#FFFCF6}
.nn-chat-form{display:flex; align-items:flex-end; gap:8px}
.nn-chat-input{
  flex:1; min-height:46px; max-height:120px; resize:none; padding:11px 14px; border-radius:16px;
  border:1.5px solid rgba(20,55,42,.28); background:#fff; color:var(--c-ink);
  font-family:inherit; font-size:16px; font-weight:400; line-height:1.4; /* 16px avoids iOS zoom */
}
.nn-chat-input::placeholder{color:#6B776F}
.nn-chat-input:focus{outline:none; border-color:var(--c-pine); box-shadow:0 0 0 3px rgba(233,162,59,.55)}
.nn-chat-send{
  flex:none; width:46px; height:46px; border-radius:50%; border:0; cursor:pointer;
  background:var(--c-honey); color:var(--c-forest); display:grid; place-items:center;
  box-shadow:0 6px 16px -8px rgba(233,162,59,.9);
}
.nn-chat-send:hover{background:#F0B252}
.nn-chat-send:disabled{opacity:.55; cursor:default}
.nn-chat-send .nn-chat-ico{width:22px;height:22px}
.nn-chat-send svg path{fill:var(--c-forest)}
.nn-chat-meta{display:flex; justify-content:space-between; align-items:baseline; gap:10px; margin-top:7px}
.nn-chat-note{margin:0; font-size:.78rem; line-height:1.35; color:var(--c-muted)}
.nn-chat-note a{color:var(--c-forest); font-weight:700; text-underline-offset:2px}
.nn-chat-count{font-size:.75rem; color:var(--c-muted); white-space:nowrap}

/* Hide when the mobile nav menu is open */
.site-header.menu-open ~ .nn-chat{display:none}

/* Mobile: bottom sheet */
@media (max-width:560px){
  .nn-chat{right:max(14px, env(safe-area-inset-right)); bottom:max(14px, env(safe-area-inset-bottom))}
  .nn-chat-launcher{min-height:54px; padding:0 18px 0 14px}
  .nn-chat.is-open{inset:0; right:0; bottom:0; gap:0; justify-content:flex-end; z-index:150} /* above the fixed site header */
  .nn-chat.is-open .nn-chat-launcher{display:none}
  .nn-chat-panel{
    width:100%; height:calc(100vh - 40px); height:calc(100dvh - 40px); max-height:none;
    border-radius:22px 22px 0 0; border-bottom:0;
    padding-bottom:env(safe-area-inset-bottom);
    transform:translateY(24px);
  }
  .nn-chat.is-open::before{content:""; position:fixed; inset:0; background:rgba(20,39,31,.45); z-index:-1; pointer-events:auto}
}

@media (prefers-reduced-motion: reduce){
  .nn-chat-panel,.nn-chat-launcher{transition:none}
  .nn-chat-typing i{animation:none; opacity:.6}
  .nn-chat-log{scroll-behavior:auto}
}
@media print{ .nn-chat{display:none!important} }

/* Keep the hero's scroll cue clear of the chat launcher (launcher is ~140px from the right edge) */
.hero .scroll-cue{right:max(170px, calc((100% - var(--container, 1200px)) / 2))}
