/* Mint AI chat widget. The markup is built by assets/js/chat.js.
   The site tokens from styles.css are read once below, each with a fallback,
   so the widget still looks right if a token is renamed or missing. */
.mc {
  --mc-mint: var(--mint, #5DDCAF);
  --mc-mint-hi: var(--mint-hi, #A8F0D4);
  --mc-rgb: var(--mint-rgb, 93, 220, 175);
  --mc-text: var(--text, #F2F5F4);
  --mc-muted: var(--muted, #8B9794);
  --mc-line: var(--line, rgba(255, 255, 255, .08));
  --mc-line-2: var(--line-strong, rgba(255, 255, 255, .15));
  --mc-ink: var(--ink, #04130D);
  --mc-amber: var(--amber, #E8B84A);
  --mc-idle: var(--idle, #5E6966);
  --mc-ease: var(--ease, cubic-bezier(.2, .7, .2, 1));
  --mc-head: var(--font-head, "Outfit", "Avenir Next", "Segoe UI", system-ui, sans-serif);
  --mc-body: var(--font-body, "Hanken Grotesk", "Segoe UI", system-ui, -apple-system, Arial, sans-serif);
  --mc-coral: 229, 139, 120;
  --mc-gap: 24px;
  /* zero-size anchor: the widget never takes part in the page layout */
  position: fixed; right: 0; bottom: 0; width: 0; height: 0; z-index: 70;
  font: 400 .9375rem/1.5 var(--mc-body); color: var(--mc-text);
}
.mc, .mc *, .mc *::before, .mc *::after { box-sizing: border-box; }
.mc [hidden] { display: none !important; }
:where(.mc) p { margin: 0; }
:where(.mc) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; }
:where(.mc) button:disabled { cursor: default; }
:where(.mc) :focus-visible { outline: 2px solid var(--mc-mint-hi); outline-offset: 2px; }
.mc-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mc-ico { display: block; flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mc-ico--fill { fill: currentColor; stroke-width: 1; }
.mc-link { color: var(--mc-mint-hi); text-decoration: underline; text-decoration-color: rgba(var(--mc-rgb), .55); text-underline-offset: 3px; border-radius: 3px; }
.mc-launcher, .mc-clear, .mc-close, .mc-chip, .mc-retry, .mc-field, .mc-send {
  transition: color .2s, background-color .2s, border-color .2s, box-shadow .2s, opacity .2s, transform .2s var(--mc-ease);
}
/* the site's primary-button look */
.mc-launcher, .mc-send { color: var(--mc-ink); background: linear-gradient(180deg, #86EAC6 0%, var(--mc-mint) 55%, #46CC9C 100%); }
.mc-sub::before, .mc-offline::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--mc-idle); }

/* Launcher */
.mc-launcher {
  position: fixed;
  right: calc(var(--mc-gap) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--mc-gap) + env(safe-area-inset-bottom, 0px) + var(--mc-lift, 0px));   /* --mc-lift: see lift() in chat.js */
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px; padding: 0 22px 0 17px; border-radius: 999px;
  font: 600 .9375rem/1 var(--mc-body); white-space: nowrap;
  box-shadow: 0 10px 34px -10px rgba(var(--mc-rgb), .7), 0 14px 30px -14px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.mc-launcher:hover { transform: translateY(-1px); }
.mc-launcher:active { transform: scale(.98); }
.mc-launcher .mc-ico { width: 20px; height: 20px; }

/* Panel */
.mc-scrim { display: none; }
.mc-panel {
  position: fixed;
  right: calc(var(--mc-gap) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--mc-gap) + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; overflow: hidden;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 128px)); height: min(560px, calc(100dvh - 128px)); min-height: 300px;
  border-radius: var(--r-card, 20px); border: 1px solid var(--mc-line-2);
  background:
    radial-gradient(130% 30% at 50% 0%, rgba(var(--mc-rgb), .15), transparent 72%),
    linear-gradient(165deg, rgba(18, 27, 23, .95), rgba(7, 11, 10, .97));
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 0 0 1px rgba(0, 0, 0, .55), 0 30px 70px -24px rgba(0, 0, 0, .95), 0 30px 90px -36px rgba(var(--mc-rgb), .42);
}

.mc-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; border-bottom: 1px solid var(--mc-line); }
.mc-avatar {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  color: var(--mc-mint); background: rgba(var(--mc-rgb), .1); border: 1px solid rgba(var(--mc-rgb), .24);
}
.mc-avatar img { display: block; width: 24px; height: 24px; object-fit: contain; }
.mc-head__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; white-space: nowrap; }
.mc-title { font: 600 1.0625rem/1.15 var(--mc-head); letter-spacing: -.015em; }
.mc-sub { display: flex; align-items: center; gap: 7px; font-size: .8125rem; line-height: 1.2; color: var(--mc-muted); }
.mc[data-online="true"] .mc-sub::before { background: var(--mc-mint); box-shadow: 0 0 9px 0 var(--mc-mint); }
.mc-tag { flex: none; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; line-height: 1.3; color: var(--mc-mint-hi); border: 1px dashed rgba(var(--mc-rgb), .6); }
.mc-clear { flex: none; min-height: 34px; padding: 0 10px; border-radius: 999px; font-size: .8125rem; font-weight: 500; color: var(--mc-muted); }
.mc-clear:hover { color: var(--mc-text); background: rgba(255, 255, 255, .06); }
.mc-close { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .04); border: 1px solid var(--mc-line); }
.mc-close:hover { border-color: rgba(var(--mc-rgb), .5); color: var(--mc-mint); }
.mc-close .mc-ico { width: 16px; height: 16px; stroke-width: 2; }

/* Conversation */
.mc-log {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 20px;
  /* messages fade out under the composer instead of being cut off */
  -webkit-mask-image: linear-gradient(#000 calc(100% - 18px), transparent); mask-image: linear-gradient(#000 calc(100% - 18px), transparent);
}
.mc-log, .mc-input { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.mc-log:focus-visible { outline-offset: -3px; border-radius: 8px; }
.mc-msg { flex: none; display: flex; }
.mc-msg--user { justify-content: flex-end; }
.mc-bubble {
  max-width: 86%; padding: 10px 14px; border-radius: 16px 16px 16px 5px;
  white-space: pre-wrap; overflow-wrap: anywhere;
  color: #E4EAE8; background: rgba(255, 255, 255, .05); border: 1px solid var(--mc-line);
}
.mc-msg--user .mc-bubble { border-radius: 16px 16px 5px 16px; color: #EFFCF6; background: rgba(var(--mc-rgb), .16); border-color: rgba(var(--mc-rgb), .32); }

.mc-chips { flex: none; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.mc-chip { min-height: 36px; padding: 0 14px; border-radius: 999px; font-size: .875rem; font-weight: 500; color: #D5DCDA; background: rgba(255, 255, 255, .03); border: 1px solid var(--mc-line-2); }
.mc-chip:hover:enabled { border-color: rgba(var(--mc-rgb), .55); background: rgba(var(--mc-rgb), .08); color: var(--mc-mint-hi); }
.mc-chip:disabled, .mc-retry:disabled { color: var(--mc-muted); border-color: var(--mc-line); }

.mc-typing .mc-bubble { display: flex; align-items: center; gap: 5px; height: 42px; padding-inline: 16px; }
.mc-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--mc-mint); opacity: .55; }

.mc-error {
  flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; border-radius: 14px;
  font-size: .875rem; line-height: 1.45; color: #EBD9D4;
  background: rgba(var(--mc-coral), .08); border: 1px solid rgba(var(--mc-coral), .28);
}
.mc-error p { flex: 1; min-width: 0; }
.mc-retry { flex: none; min-height: 32px; padding: 0 14px; border-radius: 999px; font-size: .8125rem; font-weight: 600; border: 1px solid rgba(var(--mc-coral), .5); }
.mc-retry:hover:enabled { background: rgba(var(--mc-coral), .14); }

.mc-offline {
  flex: none; display: flex; align-items: center; gap: 9px; margin: 0 14px; padding: 9px 14px; border-radius: 12px;
  font-size: .875rem; color: #C5CECB; background: rgba(255, 255, 255, .04); border: 1px solid var(--mc-line);
}
.mc-offline:empty { display: none; }

/* Composer */
.mc-form { flex: none; padding: 12px 14px; }
.mc-field { display: flex; align-items: flex-end; gap: 8px; padding: 5px 5px 5px 16px; border-radius: 23px; background: rgba(0, 0, 0, .32); border: 1px solid var(--mc-line-2); }
.mc-field:focus-within { border-color: rgba(var(--mc-rgb), .7); box-shadow: 0 0 0 3px rgba(var(--mc-rgb), .2); }
.mc-input {
  flex: 1; min-width: 0; display: block; resize: none; margin: 0; padding: 7px 0; max-height: calc(1.45em * 4 + 14px);
  font: inherit; line-height: 1.45; color: var(--mc-text); background: none; border: 0; outline: none;
}
.mc-input:focus-visible { outline: none; }   /* the focus ring is drawn on .mc-field */
.mc-input::placeholder { color: var(--mc-muted); opacity: 1; }
.mc-input:read-only { color: var(--mc-muted); cursor: default; }   /* offline: the draft is kept but cannot be edited or sent */
.mc-count { flex: none; padding-bottom: 9px; font-size: .75rem; line-height: 1.5; color: var(--mc-muted); font-variant-numeric: tabular-nums; }
.mc-count.is-full { color: var(--mc-amber); }
.mc-send { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; box-shadow: 0 8px 22px -8px rgba(var(--mc-rgb), .8), inset 0 1px 0 rgba(255, 255, 255, .45); }
.mc-send:hover:enabled { transform: translateY(-1px); }
.mc-send:disabled { color: var(--mc-muted); background: rgba(255, 255, 255, .06); box-shadow: none; }
.mc-send .mc-ico { stroke-width: 2.2; }
.mc-note { margin-top: 9px; font-size: .75rem; line-height: 1.4; color: var(--mc-muted); text-align: center; }

/* Launcher size. On wide screens the pill sits a little further in, inside the hero frame and clear of the
   stats bar. From 1280px down there is no free corner for a pill on the first screen (it would cover the end
   of the stats bar or the last card), so the launcher becomes a round button. */
@media (min-width: 1281px) {
  .mc { --mc-gap: 36px; }
}
@media (max-width: 1280px), (max-height: 480px) {
  .mc-launcher { width: 54px; height: 54px; min-height: 0; padding: 0; }
  .mc-launcher__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .mc-launcher .mc-ico { width: 24px; height: 24px; }
}
/* The site's mobile menu (styles.css, same width): the chat steps aside while the menu is open. The panel
   stays open and comes back when the menu closes. */
@media (max-width: 760px) {
  body:has(.site-header.is-open) .mc-launcher,
  body:has(.site-header.is-open) .mc-panel { opacity: 0; visibility: hidden; }
}
/* Touch screens and small windows: every control is at least 40px to tap. */
@media (max-width: 640px), (max-height: 480px), (pointer: coarse) {
  .mc-close, .mc-send { width: 40px; height: 40px; }
  .mc-chip, .mc-clear, .mc-retry { min-height: 40px; }
}
/* Phones and very short windows: bottom sheet.
   chat.js uses the same media query: keep the two in step. */
@media (max-width: 640px), (max-height: 480px) {
  .mc { --mc-gap: 16px; --mc-enter: mc-up; }
  .mc-scrim { display: block; position: fixed; inset: 0; background: rgba(3, 6, 5, .68); backdrop-filter: blur(3px); touch-action: none; }
  .mc-panel {
    left: 0; right: 0; bottom: var(--mc-kb, 0px); width: 100%; min-height: 0;   /* --mc-kb: on-screen keyboard height, set by chat.js */
    height: min(86vh, calc(100vh - var(--mc-kb, 0px) - 12px)); height: min(86dvh, calc(100dvh - var(--mc-kb, 0px) - 12px));
    border-radius: 24px 24px 0 0; border-width: 1px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mc-input { font-size: 1rem; }   /* 16px stops iOS zooming the page on focus */
  html.mc-open { overflow: hidden; }
}
/* Very short windows (a phone on its side, or a desktop zoomed to 400%): the sheet takes the full height and
   its header and composer tighten up, so the conversation keeps enough room to be read. */
@media (max-height: 480px) {
  .mc-panel { height: calc(100vh - var(--mc-kb, 0px)); height: calc(100dvh - var(--mc-kb, 0px)); border-radius: 0; }
  .mc-head { padding-block: 6px; }
  .mc-avatar, .mc-sub { display: none; }
  .mc-form { padding-block: 6px; }
  .mc-note { margin-top: 4px; }
  .mc-log { padding-block: 10px; -webkit-mask-image: none; mask-image: none; }
}
@media (max-width: 360px) {
  .mc-avatar { display: none; }   /* room for the header buttons on the narrowest phones */
}

/* Motion: only in answer to the visitor's own actions, and only if they have not asked for less */
@media (prefers-reduced-motion: no-preference) {
  .mc-launcher { animation: mc-pop .45s var(--mc-ease); }
  .mc-scrim { animation: mc-fade .2s; }
  .mc-panel { animation: var(--mc-enter, mc-in) .3s var(--mc-ease); }
  .mc-typing i { animation: mc-dot 1.2s ease-in-out infinite; }
  .mc-typing i:nth-child(2) { animation-delay: .16s; }
  .mc-typing i:nth-child(3) { animation-delay: .32s; }
  @keyframes mc-pop { from { opacity: 0; transform: translateY(8px) scale(.94); } }
  @keyframes mc-in { from { opacity: 0; transform: translateY(10px); } }
  @keyframes mc-up { from { opacity: 0; transform: translateY(48px); } }
  @keyframes mc-fade { from { opacity: 0; } }
  @keyframes mc-dot { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
}
@media print { .mc { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .mc *, .mc *::before, .mc *::after { transition-duration: .01ms !important; animation: none !important; }
}
