/* J&J site enhancements: mobile menu, form states, Julia chat panel. Uses the design tokens from styles.css. */

/* ---------- mobile menu ---------- */
.jj-menu{position:fixed;inset:0;z-index:70;display:flex;flex-direction:column;gap:.25rem;padding:5rem 1.5rem 2rem;
  background:color-mix(in srgb,var(--background) 96%,transparent);backdrop-filter:blur(18px);overflow-y:auto}
.jj-menu[hidden]{display:none}
.jj-menu a{display:block;padding:.9rem .25rem;font-size:1.25rem;font-weight:600;color:var(--foreground);
  border-bottom:1px solid var(--border);text-decoration:none}
.jj-menu a[aria-current="page"]{color:var(--primary)}
.jj-menu a.jj-cta{margin-top:1.25rem;text-align:center;border:0;border-radius:999px;background:var(--primary);
  color:var(--primary-foreground)}
.jj-menu-close{position:absolute;top:1rem;right:1.25rem;width:2.75rem;height:2.75rem;border-radius:999px;border:1px solid var(--border);
  background:transparent;color:var(--foreground);font-size:1.5rem;line-height:1;cursor:pointer}
body.jj-lock{overflow:hidden}

/* ---------- forms ---------- */
.jj-hp{position:absolute!important;left:-9999px!important;width:1px;height:1px;overflow:hidden}
.jj-form-msg{grid-column:1/-1;margin:0;padding:.75rem 1rem;border-radius:.75rem;font-size:.875rem}
.jj-form-msg.is-error{background:color-mix(in srgb,var(--destructive) 18%,transparent);border:1px solid var(--destructive);color:var(--foreground)}
.jj-form-success{grid-column:1/-1;text-align:center;padding:2.5rem 1rem}
.jj-form-success h3{font-size:1.5rem;font-weight:700;color:var(--primary);margin:0 0 .5rem}
.jj-form-success p{color:var(--muted-foreground);margin:0}
form [aria-invalid="true"]{border-color:var(--destructive)!important}
form button[disabled]{opacity:.6;cursor:progress}

/* ---------- Julia chat ---------- */
.jj-chat{position:fixed;right:1.25rem;bottom:1.25rem;z-index:60;display:flex;flex-direction:column;
  width:min(390px,calc(100vw - 1.5rem));height:min(580px,calc(100dvh - 2rem));
  background:var(--popover);color:var(--foreground);border:1px solid color-mix(in srgb,var(--primary) 30%,transparent);
  border-radius:1.25rem;box-shadow:0 24px 60px -12px #000c;overflow:hidden}
.jj-chat[hidden]{display:none}
.jj-chat-head{display:flex;align-items:center;gap:.75rem;padding:.85rem 1rem;border-bottom:1px solid var(--border);background:var(--secondary)}
.jj-chat-head img{width:2.5rem;height:2.5rem;border-radius:999px;object-fit:cover;object-position:top;border:2px solid var(--primary)}
.jj-chat-head strong{display:block;font-size:.95rem}
.jj-chat-head span{font-size:.75rem;color:var(--muted-foreground)}
.jj-chat-head button{margin-left:auto;width:2.25rem;height:2.25rem;border-radius:999px;border:0;background:transparent;color:var(--foreground);font-size:1.4rem;cursor:pointer}
.jj-chat-log{flex:1;overflow-y:auto;padding:1rem;display:flex;flex-direction:column;gap:.6rem}
.jj-msg{max-width:85%;padding:.6rem .85rem;border-radius:1rem;font-size:.9rem;line-height:1.45;white-space:pre-wrap;word-wrap:break-word}
.jj-msg.bot{align-self:flex-start;background:var(--secondary);border-bottom-left-radius:.25rem}
.jj-msg.me{align-self:flex-end;background:var(--primary);color:var(--primary-foreground);border-bottom-right-radius:.25rem}
.jj-msg.err{align-self:flex-start;background:color-mix(in srgb,var(--destructive) 18%,transparent);border:1px solid var(--destructive)}
.jj-typing{display:inline-flex;gap:.25rem;align-self:flex-start;padding:.7rem .9rem;background:var(--secondary);border-radius:1rem}
.jj-typing i{width:.4rem;height:.4rem;border-radius:99px;background:var(--muted-foreground);animation:jj-b 1s infinite ease-in-out}
.jj-typing i:nth-child(2){animation-delay:.15s}.jj-typing i:nth-child(3){animation-delay:.3s}
@keyframes jj-b{0%,80%,100%{opacity:.3;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}
.jj-chips{display:flex;flex-wrap:wrap;gap:.4rem;padding:0 1rem .5rem}
.jj-chips button{font-size:.78rem;padding:.4rem .7rem;border-radius:999px;border:1px solid var(--border);background:transparent;color:var(--foreground);cursor:pointer}
.jj-chips button:hover{border-color:var(--primary);color:var(--primary)}
.jj-chat-form{display:flex;align-items:flex-end;gap:.5rem;padding:.75rem;border-top:1px solid var(--border)}
.jj-chat-form textarea{flex:1;resize:none;max-height:7rem;border-radius:.75rem;border:1px solid var(--input);background:color-mix(in srgb,var(--secondary) 40%,transparent);
  color:var(--foreground);padding:.6rem .8rem;font:inherit;font-size:.9rem;outline:none}
.jj-chat-form textarea:focus{border-color:var(--primary)}
.jj-chat-form button{border:0;border-radius:999px;background:var(--primary);color:var(--primary-foreground);font-weight:700;padding:.65rem 1rem;cursor:pointer}
.jj-chat-form button[disabled]{opacity:.5;cursor:progress}
@media (max-width:520px){.jj-chat{right:.75rem;bottom:.75rem}}
@media (prefers-reduced-motion:reduce){.jj-typing i{animation:none}}

/* ---------- layout guard ---------- */
/* The Team page's orbiting avatars extend ~10px past the viewport on phones, which caused sideways scrolling.
   `clip` (unlike `hidden`) keeps position:sticky / fixed elements working. */
html, body { overflow-x: clip; }
