@font-face {
  font-family: "Neue Haas Unica";
  src: url("./fonts/NHU-Light.ttf") format("truetype");
  font-style: normal;
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "Neue Haas Unica";
  src: url("./fonts/NHU-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Neue Haas Unica";
  src: url("./fonts/NHU-Med.otf") format("opentype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Inp";
  src: url("./fonts/Inp.ttf") format("truetype");
  font-style: normal;
  font-weight: 300 400;
  font-display: swap;
}

:root {
  --ink: #f0f0f0;
  --muted: #999;
  --quiet: #6e6e6e;
  --paper: #000;
  --line: rgba(240, 240, 240, .18);
  --line-strong: rgba(240, 240, 240, .3);
  --accent: #7ebb1c;
  --accent-glass: rgba(126, 187, 28, .15);
  --accent-glass-soft: rgba(126, 187, 28, .3);
  --accent-fill: #4d760a;
  --accent-fill-hover: #527d0c;
  --accent-fill-active: #456b08;
  --white: #fff;
  --glass: rgba(255, 255, 255, .045);
  --glass-strong: rgba(255, 255, 255, .085);
  --glass-dark: rgba(0, 0, 0, .44);
  --glass-blur: blur(22px) saturate(120%);
  --ease: cubic-bezier(.2, 0, 0, 1);
  --reveal: cubic-bezier(.22, 1, .36, 1);
  --display: "Neue Haas Unica", "Helvetica Neue", Arial, sans-serif;
  --body: "Neue Haas Unica", "Helvetica Neue", Arial, sans-serif;
  --mono: "Inp", "Neue Haas Unica", Arial, sans-serif;
}

[data-theme="light"] {
  --ink: #1a1a1a;
  --muted: #4a4a4a;
  --quiet: #7a7a7a;
  --paper: #f8f8f8;
  --line: rgba(26, 26, 26, .18);
  --line-strong: rgba(26, 26, 26, .28);
  --accent-glass: rgba(126, 187, 28, .16);
  --accent-glass-soft: rgba(126, 187, 28, .28);
  --accent-fill: #4d760a;
  --accent-fill-hover: #527d0c;
  --accent-fill-active: #456b08;
  --glass: rgba(255, 255, 255, .38);
  --glass-strong: rgba(255, 255, 255, .56);
  --glass-dark: rgba(248, 248, 248, .68);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: transparent;
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  font-weight: 300;
}
[data-theme="light"] body { color: var(--ink); }
body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: transparent;
  content: "";
  pointer-events: none;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.chatbot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 16px;
}
.mode-switch {
  position: relative;
  display: grid;
  flex: 0 0 40px;
  grid-template-columns: repeat(2, 1fr);
  align-self: center;
  width: min(100%, 274px);
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .045);
  box-shadow: inset 0 1px rgba(255, 255, 255, .06);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.mode-switch-indicator {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(26, 26, 26, .12);
  transition: left .42s var(--reveal), background-color .2s ease, box-shadow .2s ease;
}
[data-theme="light"] .mode-switch-indicator {
  background: #1a1a1a;
  box-shadow: 0 4px 14px rgba(26, 26, 26, .18);
}
.chatbot[data-mode="contact"] .mode-switch-indicator { left: 50%; }
.mode-option {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  transition: color .2s ease, background-color .2s ease;
}
.mode-option:hover { background: rgba(255, 255, 255, .055); color: var(--ink); }
.mode-option[aria-pressed="true"] { color: var(--ink); }
[data-theme="light"] .mode-option[aria-pressed="true"] { color: #fff; }
[data-theme="dark"] .mode-option[aria-pressed="true"] { color: #1a1a1a; }
.mode-option:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.mode-panel { min-height: 0; }
.mode-panel.is-leaving { pointer-events: none; animation: mode-panel-leave .14s ease-in both; }
.mode-panel.is-entering { animation: mode-panel-enter .26s var(--reveal) both; }
.chat-mode-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0 12px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass);
  box-shadow: inset 0 1px rgba(255, 255, 255, .08), 0 12px 40px rgba(0, 0, 0, .18);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.chat-header, .input-bar {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass);
  box-shadow: inset 0 1px rgba(255, 255, 255, .08), 0 12px 40px rgba(0, 0, 0, .18);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}
.header-profile { display: flex; align-items: center; gap: 10px; }
.header-avatar { display: block; width: 36px; height: 36px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
h1 { margin: 0; font-family: var(--display); font-size: clamp(21px, 2vw, 25px); font-weight: 300; letter-spacing: -.03em; }
.status { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .03); color: var(--muted); font-family: var(--mono); font-size: 10px; font-weight: 400; letter-spacing: 0; text-transform: uppercase; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--quiet); }
.status[data-status="ready"] { color: var(--ink); border-color: var(--accent); background: var(--accent-glass); }
.status[data-status="ready"] .status-dot { background: var(--accent); }
.status[data-status="loading"] .status-dot { animation: pulse 1.2s ease-in-out infinite; }
.status[data-status="error"] { color: #efa58f; }

.chat-window {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 0 4px 16px;
}
.chat-window::-webkit-scrollbar { width: 4px; }
.chat-window::-webkit-scrollbar-track { background: transparent; }
.chat-window::-webkit-scrollbar-thumb { border-radius: 999px; background: var(--line); }
.message { display: flex; gap: 10px; max-width: min(88%, 640px); animation: enter .42s var(--reveal) both; }
.message:first-child { margin-top: 16px; }
.message--user { align-self: flex-end; flex-direction: row-reverse; }
.avatar { display: grid; flex: 0 0 30px; width: 30px; height: 30px; overflow: hidden; place-items: center; margin-top: 2px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .03); color: var(--ink); font-family: var(--mono); font-size: 9px; font-weight: 400; text-transform: uppercase; }
.profile-image { width: 100%; height: 100%; object-fit: cover; object-position: center 19%; transform: scale(1.92); }
.message--user .avatar { border-color: var(--accent); background: var(--accent-glass-soft); color: var(--ink); }
.message-content { display: grid; min-width: 0; gap: 8px; }
.bubble { margin: 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--glass-strong); box-shadow: inset 0 1px rgba(255, 255, 255, .06); line-height: 1.5; overflow-wrap: anywhere; }
.message--user .bubble { border-color: var(--accent); background: var(--accent-glass); color: var(--white); }
.message-download { display: inline-flex; align-items: center; justify-content: center; justify-self: start; gap: 7px; min-height: 32px; padding: 0 10px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent-glass); color: var(--ink); font-family: var(--mono); font-size: 11px; font-weight: 400; text-decoration: none; text-transform: uppercase; transition: background-color .2s ease, border-color .2s ease; }
.message-download:hover { border-color: var(--accent-fill-hover); background: rgba(126, 187, 28, .25); }
.message-download:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.message-download svg { width: 12px; height: 12px; }
.typing { align-items: center; }
.typing-dots { display: flex; gap: 4px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--glass-strong); }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--quiet); animation: pulse 1.1s ease-in-out infinite; }
.typing-dots i:nth-child(2) { animation-delay: .14s; }
.typing-dots i:nth-child(3) { animation-delay: .28s; }

.chat-controls {
  flex: 0 0 auto;
  width: calc(100% + 24px);
  margin-right: -12px;
  margin-left: -12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.chip-mask { min-width: 0; overflow: hidden; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; padding: 0 12px 9px; cursor: grab; scrollbar-width: none; touch-action: pan-x; -webkit-overflow-scrolling: touch; user-select: none; }
.chip-row.is-dragging { cursor: grabbing; }
.chip-row::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; height: 32px; padding: 0 8px; border: .5px solid var(--line-strong); border-radius: 8px; background: rgba(255, 255, 255, .03); color: var(--ink); font-family: var(--mono); font-size: 11px; font-weight: 400; text-transform: uppercase; white-space: nowrap; backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); transition: border-color .2s ease, background-color .2s ease; }
.chip:hover { border-color: var(--accent); background: var(--accent-glass); }
.chip:active { background: rgba(126, 187, 28, .25); }
.chip:disabled { cursor: wait; opacity: .42; }
.chip:focus-visible, .send-button:focus-visible, .contact-form button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.input-bar { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; margin: 0 12px; padding: 7px 7px 7px 14px; }
.input-bar:focus-within { border-color: var(--accent); }
.input-bar input { flex: 1 1 auto; min-width: 0; height: 36px; border: 0; outline: 0; background: transparent; color: var(--ink); }
.send-button { display: grid; flex: 0 0 32px; width: 32px; height: 32px; place-items: center; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent-glass-soft); color: var(--ink); transition: border-color .2s ease, background-color .2s ease; }
.send-button:hover { border-color: var(--accent); background: rgba(126, 187, 28, .38); }
.send-button:active { border-color: var(--accent); background: rgba(126, 187, 28, .46); }
.send-button:disabled { cursor: not-allowed; opacity: .35; transform: none; }
.send-button svg { width: 18px; height: 18px; }

@media (min-width: 641px) {
  .send-button { flex-basis: 56px; width: 56px; }
}

.contact-form { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--glass-strong); }
.contact-form label { display: grid; gap: 4px; color: var(--muted); font-family: var(--mono); font-size: 10px; font-weight: 400; letter-spacing: 0; text-transform: uppercase; }
.contact-form input, .contact-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; background: var(--glass-dark); padding: 8px; color: var(--ink); font-family: var(--body); font-size: 13px; resize: vertical; }
.contact-form button { display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent-glass); color: var(--white); font-family: var(--mono); font-size: 13px; font-weight: 400; transition: background-color .15s ease; }
.contact-form button:hover { background: rgba(126, 187, 28, .25); }
.contact-form button svg { width: 14px; height: 14px; }
.contact-success { display: grid; gap: 4px; margin: 0; color: var(--muted); font-size: 13px; }
.contact-success strong { color: var(--ink); font-family: var(--display); font-size: 16px; font-weight: 500; }

.contact-mode-panel {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow-y: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--glass);
  box-shadow: inset 0 1px rgba(255, 255, 255, .08), 0 12px 40px rgba(0, 0, 0, .18);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}
.direct-contact-form { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 12px; }
.direct-contact-field { display: grid; flex: 0 0 auto; }
.direct-contact-field:has(textarea) { display: flex; flex: 1 1 auto; min-height: 112px; flex-direction: column; }
.direct-contact-field span {
  align-self: flex-start;
  justify-self: start;
  padding: 3px 10px;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: rgba(255, 255, 255, .06);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
}
.direct-contact-field input, .direct-contact-field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 0 4px 4px 4px;
  outline: 0;
  background: rgba(0, 0, 0, .28);
  color: var(--ink);
  font-size: 15px;
  font-weight: 300;
  padding: 10px;
  transition: border-color .15s ease, background-color .15s ease;
}
[data-theme="light"] .direct-contact-field input,
[data-theme="light"] .direct-contact-field textarea {
  background: rgba(255, 255, 255, .72);
}
[data-theme="light"] .message--user .bubble { color: var(--ink); }
[data-theme="light"] .direct-contact-submit {
  background: var(--accent-glass-soft);
  color: var(--ink);
}
[data-theme="light"] .direct-contact-submit:hover { background: rgba(126, 187, 28, .36); }
.direct-contact-field input { height: 44px; }
.direct-contact-field textarea { flex: 1 1 auto; min-height: 0; resize: none; }
.direct-contact-field input:hover, .direct-contact-field textarea:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, .06); }
[data-theme="light"] .direct-contact-field input:hover,
[data-theme="light"] .direct-contact-field textarea:hover { background: rgba(255, 255, 255, .84); }
.direct-contact-field input:focus, .direct-contact-field textarea:focus { border-color: var(--accent); background: rgba(0, 0, 0, .38); }
[data-theme="light"] .direct-contact-field input:focus,
[data-theme="light"] .direct-contact-field textarea:focus { background: rgba(255, 255, 255, .92); }
.direct-contact-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-glass-soft);
  color: var(--white);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  transition: background-color .15s ease;
  margin-top: auto;
}
.direct-contact-submit:hover { background: rgba(126, 187, 28, .38); }
.direct-contact-submit:disabled { cursor: wait; opacity: .62; }
.direct-contact-submit:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.direct-contact-submit svg { width: 14px; height: 14px; }
.direct-contact-success { margin: 0; color: var(--accent); font-family: var(--mono); font-size: 11px; line-height: 1.4; text-transform: uppercase; }

@keyframes pulse { 50% { opacity: .35; transform: scale(.78); } }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes mode-panel-leave { to { opacity: 0; transform: translateY(6px); } }
@keyframes mode-panel-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (max-width: 520px) {
  .chatbot { gap: 8px; padding: 8px; }
  .mode-switch { flex-basis: 38px; height: 38px; }
  .mode-switch-indicator { height: 30px; }
  .chat-header { display: none; }
  .chat-window { gap: 10px; padding: 0 12px 12px; }
  .message { max-width: 96%; }
  .message:first-child { margin-top: 12px; }
  .avatar { flex-basis: 27px; width: 27px; height: 27px; font-size: 9px; }
  .bubble { padding: 8px 9px; font-size: 12.5px; }
  .chatbot[data-mode="contact"] .contact-mode-panel { padding: 10px; }
  .chatbot[data-mode="contact"] .direct-contact-form { gap: 12px; }
  .chatbot[data-mode="contact"] .direct-contact-field span { padding: 2px 8px; font-size: 10px; }
  .chatbot[data-mode="contact"] .direct-contact-field input { height: 38px; padding: 8px; }
  .chatbot[data-mode="contact"] .direct-contact-field:has(textarea) { min-height: 72px; }
  .chatbot[data-mode="contact"] .direct-contact-field textarea { padding: 8px; }
  .chatbot[data-mode="contact"] .direct-contact-submit { height: 40px; }
}
@media (max-width: 760px) {
  .contact-mode-panel { padding: 14px; }
}
@media (min-width: 521px) and (max-width: 1024px) {
  .direct-contact-field:has(textarea) { min-height: 96px; }
  .direct-contact-field textarea { min-height: 0; }
}
