/* ═══════════════════════════════════════════════════
   WP Artisans — AI Mode
   The menu button, and the chat that opens from it.
   Forest and blush, Playfair for the voice, Poppins for the
   answers, and DM Mono for the workshop scanner.
═══════════════════════════════════════════════════ */

@property --ai-spin {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

/* Its own copy of the brand tokens, so it looks the same on pages with their own stylesheet (the Playbook). */
.nav-ai,
.nav-ai-row,
.ai-dialog {
  --ai-forest:     #2f463e;
  --ai-forest-dk:  #243a27;
  --ai-blush:      #f7cfbf;
  --ai-blush-lt:   #fbe4d9;
  --ai-cream:      #f2ece9;
  --ai-clay:       #7a5c4a;
  --ai-green:      #5c7d60;
  --ai-ink-light:  rgba(47,70,62,.62);
  --ai-ink-faint:  rgba(47,70,62,.38);
  --ai-border:     rgba(47,70,62,.1);
  --ai-border-dk:  rgba(47,70,62,.18);
  --ai-ease:       cubic-bezier(.2,.7,.2,1);
}

/* ── MENU BUTTON ── */
.nav-ai {
  --ai-ring: conic-gradient(from var(--ai-spin), rgba(47,70,62,.16), var(--ai-blush) 22%, rgba(47,70,62,.62) 50%, var(--ai-blush) 78%, rgba(47,70,62,.16));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 17px 10px 13px;
  border: 1px solid transparent;
  border-radius: 100px;
  background: linear-gradient(#fff, #fff) padding-box, var(--ai-ring) border-box;
  color: var(--ai-forest);
  font: 400 10px/17px 'Poppins', sans-serif;
  letter-spacing: .16em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  animation: ai-spin 7s linear infinite;
  transition: background .25s var(--ai-ease), box-shadow .25s var(--ai-ease);
}
.nav-ai:hover,
.nav-ai:focus-visible {
  background: linear-gradient(var(--ai-blush-lt), var(--ai-blush-lt)) padding-box, var(--ai-ring) border-box;
  box-shadow: 0 6px 18px rgba(47,70,62,.12);
  outline: none;
}
.nav-ai:focus-visible { box-shadow: 0 0 0 3px rgba(247,207,191,.9); }
.nav-ai svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: currentColor;
}
@keyframes ai-spin { to { --ai-spin: 360deg; } }

/* The phone header keeps AI Mode beside the menu button; while the menu is open, its own row takes over. */
.nav-ai--bar { display: none; }
.site-nav:has(.nav-burger.open) .nav-ai--bar { visibility: hidden; opacity: 0; pointer-events: none; }

/* Inside the phone menu. */
.nav-mobile .nav-ai-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--ai-border);
  background: none;
  color: var(--ai-forest);
  font: 400 13px/1.7 'Poppins', sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
}
.nav-ai-row svg { width: 14px; height: 14px; fill: currentColor; flex: none; }
.nav-ai-row small {
  margin-left: auto;
  font: 400 10px/1 'DM Mono', ui-monospace, monospace;
  letter-spacing: .04em;
  text-transform: lowercase;
  color: var(--ai-ink-faint);
}

/* Room for the extra item on narrower desktops. */
@media (max-width: 1100px) and (min-width: 769px) {
  .nav-links { gap: 24px; }
}
@media (max-width: 880px) and (min-width: 769px) {
  .nav-links { gap: 18px; }
  .nav-links .nav-cta { padding-inline: 18px; }
}
@media (max-width: 768px) {
  .nav-ai--bar {
    display: inline-flex;
    margin-left: auto;
    margin-right: -14px;
    padding: 8px 14px 8px 11px;
  }
}
@media (max-width: 360px) {
  .nav-ai--bar { padding: 9px; }
  .nav-ai--bar span { display: none; }
}

/* ── THE CHAT WINDOW ── */
html.ai-open { overflow: hidden; scrollbar-gutter: stable; }

.ai-dialog {
  --ai-gutter: clamp(18px, 4vw, 32px);
  position: fixed;
  inset: 0;
  width: min(1000px, calc(100vw - 48px));
  height: min(860px, calc(100vh - 48px));
  height: min(860px, calc(100dvh - 48px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: #fff;
  color: var(--ai-forest);
  font: 300 15px/1.7 'Poppins', sans-serif;
  text-align: left;
  overflow: hidden;
  box-shadow: 0 40px 120px -24px rgba(20,34,29,.5), 0 0 0 1px rgba(47,70,62,.08);
}
.ai-dialog::backdrop {
  background: rgba(28,42,37,.4);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  backdrop-filter: blur(8px) saturate(120%);
}
.ai-dialog:focus { outline: none; }
/* Resets stay at zero specificity, so every component rule below wins over them. */
.ai-dialog :where(*, *::before, *::after) { box-sizing: border-box; }
.ai-dialog [hidden] { display: none !important; }
.ai-dialog :where(button, textarea) { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.ai-dialog :where(svg) { display: block; max-width: none; }
.ai-dialog a:focus-visible,
.ai-dialog button:focus-visible {
  outline: 2px solid var(--ai-forest);
  outline-offset: 3px;
}

/* Arrives softly; leaves a touch faster. */
.ai-dialog[open] { animation: ai-in .5s var(--ai-ease) both; }
.ai-dialog[open]::backdrop { animation: ai-fade .5s ease both; }
.ai-dialog[open].is-closing { animation: ai-out .26s cubic-bezier(.4,0,.6,1) both; }
.ai-dialog[open].is-closing::backdrop { animation: ai-fade-out .26s ease both; }
@keyframes ai-in { from { opacity: 0; transform: translateY(16px) scale(.975); } to { opacity: 1; transform: none; } }
@keyframes ai-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes ai-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ai-fade-out { from { opacity: 1; } to { opacity: 0; } }

.ai-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background:
    radial-gradient(70% 46% at 50% -8%, rgba(247,207,191,.62), transparent 72%),
    radial-gradient(40% 30% at 100% 100%, rgba(242,236,233,.9), transparent 70%),
    #fff;
}

/* Top bar: the monogram, "AI Mode", and the workshop's status light. */
.ai-top {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 72px;
  padding: 0 18px 0 22px;
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ai-ease), background .3s var(--ai-ease);
}
.has-messages .ai-top {
  border-bottom-color: var(--ai-border);
  background: rgba(255,255,255,.72);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.ai-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ai-brand__text { display: grid; gap: 3px; min-width: 0; }
.ai-brand__title {
  font: 400 20px/1 'Playfair Display', serif;
  letter-spacing: -.005em;
  color: var(--ai-forest);
  white-space: nowrap;
}
.ai-brand__title em { font-style: italic; }
.ai-brand__status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 400 9.5px/1 'DM Mono', ui-monospace, monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ai-ink-faint);
  white-space: nowrap;
}
.ai-brand__status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6f9075;
  box-shadow: 0 0 0 3px rgba(111,144,117,.18);
  animation: ai-pulse 2.2s ease-in-out infinite;
}
@keyframes ai-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.ai-top__actions { display: flex; align-items: center; gap: 8px; }

/* The assistant is the W monogram, white on forest. */
.ai-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ai-forest);
  box-shadow: 0 0 0 4px rgba(247,207,191,.55);
}
.ai-avatar::before {
  content: '';
  width: 64%;
  height: 64%;
  background: #fff;
  -webkit-mask: url('/assets/img/logo-mark.png') center / contain no-repeat;
  mask: url('/assets/img/logo-mark.png') center / contain no-repeat;
}

.ai-new {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px 0 13px;
  border: 1px solid var(--ai-border-dk);
  border-radius: 100px;
  background: #fff;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.ai-new svg { width: 15px; height: 15px; }
.ai-new:hover { background: var(--ai-blush-lt); border-color: rgba(47,70,62,.3); }
.ai-icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--ai-border);
  border-radius: 50%;
  background: rgba(255,255,255,.8);
  color: var(--ai-forest);
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .3s var(--ai-ease);
}
.ai-icon-btn:hover { background: var(--ai-blush-lt); border-color: rgba(47,70,62,.24); }
.ai-close:hover { transform: rotate(90deg); }
.ai-dialog .ai-icon-btn svg,
.ai-dialog .ai-new svg,
.ai-dialog .ai-tool svg,
.ai-dialog .ai-send svg,
.ai-dialog .ai-chip svg,
.ai-dialog .ai-down svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ai-icon-btn svg { width: 18px; height: 18px; }

/* The conversation. Before the first question, the welcome and the composer sit together in the middle. */
.ai-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px var(--ai-gutter) 0;
  scrollbar-width: thin;
  scrollbar-color: var(--ai-border-dk) transparent;
}
/* Words fade out under the top bar and above the composer, rather than being cut. */
.has-messages .ai-scroll {
  -webkit-mask: linear-gradient(transparent, #000 18px, #000 calc(100% - 28px), transparent);
  mask: linear-gradient(transparent, #000 18px, #000 calc(100% - 28px), transparent);
}
.ai-dialog:not(.has-messages) .ai-scroll { flex: 0 1 auto; margin-top: auto; }
.ai-dialog:not(.has-messages) .ai-dock { margin-bottom: auto; }
.ai-messages:empty { display: none; }

.ai-welcome {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 0 28px;
  text-align: center;
}
.ai-welcome__mark {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 10px rgba(247,207,191,.38), 0 0 0 1px rgba(47,70,62,.1), 0 18px 40px -18px rgba(47,70,62,.45);
}
.ai-welcome__mark::before {
  content: '';
  position: absolute;
  inset: 22% 16%;
  background: var(--ai-forest);
  -webkit-mask: url('/assets/img/logo-mark.png') center / contain no-repeat;
  mask: url('/assets/img/logo-mark.png') center / contain no-repeat;
}
.ai-welcome__spark {
  position: absolute;
  width: 15px;
  height: 15px;
  fill: var(--ai-forest);
}
.ai-welcome__spark--a { top: -12px; right: -14px; }
.ai-welcome__spark--b { bottom: -6px; left: -16px; width: 10px; height: 10px; fill: var(--ai-clay); }
.ai-eyebrow {
  display: block;
  margin-bottom: 14px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--ai-ink-faint);
}
.ai-welcome h2 {
  margin: 0 0 14px;
  font: 400 clamp(30px, 4.2vw, 46px)/1.12 'Playfair Display', serif;
  letter-spacing: -.012em;
  color: var(--ai-forest);
  text-wrap: balance;
}
.ai-welcome h2 em { font-style: italic; }
.ai-welcome p {
  max-width: 470px;
  text-wrap: balance;
  margin: 0 auto;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--ai-ink-light);
}

.ai-messages {
  display: grid;
  gap: 30px;
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 0 36px;
}
.ai-message { min-width: 0; animation: ai-rise .45s var(--ai-ease) both; }
@keyframes ai-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ai-message--user { display: flex; justify-content: flex-end; }
.ai-question {
  max-width: min(82%, 560px);
  padding: 12px 18px;
  border-radius: 22px 22px 6px 22px;
  background: var(--ai-blush-lt);
  color: var(--ai-forest);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ai-message--assistant {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  column-gap: 16px;
  align-items: start;
}
.ai-message--assistant > .ai-avatar { margin-top: 1px; }
.ai-body { min-width: 0; padding-top: 5px; }
.ai-notice {
  margin: 0 0 10px;
  font: 400 10.5px/1.6 'DM Mono', ui-monospace, monospace;
  color: var(--ai-clay);
}
.ai-answer {
  font-size: 15px;
  line-height: 1.78;
  color: var(--ai-forest);
  overflow-wrap: anywhere;
}
.ai-answer > * + * { margin-top: 12px; }
.ai-answer strong { font-weight: 500; }
.ai-answer ul { display: grid; gap: 6px; padding: 0; list-style: none; }
.ai-answer li { position: relative; padding-left: 22px; }
.ai-answer li::before {
  content: '';
  position: absolute;
  left: 3px;
  top: .82em;
  width: 9px;
  height: 1px;
  background: var(--ai-forest);
  opacity: .45;
}
.ai-message.is-error .ai-answer { color: var(--ai-clay); }

/* While an answer streams in, a soft caret follows the words. */
.ai-caret {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--ai-forest);
  vertical-align: middle;
  animation: ai-caret 1s ease-in-out infinite;
}
@keyframes ai-caret { 0%, 100% { opacity: .25; transform: scale(.75); } 50% { opacity: 1; transform: scale(1); } }

/* Buttons to the right page, or the right person. */
.ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  animation: ai-rise .4s var(--ai-ease) both;
}
.ai-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--ai-border-dk);
  border-radius: 100px;
  background: #fff;
  color: var(--ai-forest);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background .2s, border-color .2s, transform .2s var(--ai-ease), box-shadow .2s;
}
.ai-action:hover { background: var(--ai-blush-lt); border-color: rgba(47,70,62,.3); transform: translateY(-1px); }
.ai-action--primary { background: var(--ai-forest); border-color: var(--ai-forest); color: #fff; }
.ai-action--primary:hover { background: var(--ai-forest-dk); border-color: var(--ai-forest-dk); box-shadow: 0 6px 18px rgba(47,70,62,.2); }

.ai-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--ai-border);
  animation: ai-rise .4s var(--ai-ease) .08s both;
}
.ai-sources { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 0; }
.ai-sources__label {
  font: 400 9.5px/1 'DM Mono', ui-monospace, monospace;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ai-ink-faint);
}
.ai-source {
  font-size: 12px;
  color: var(--ai-ink-light);
  text-decoration: underline;
  text-decoration-color: var(--ai-blush);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  transition: color .2s, text-decoration-color .2s;
}
.ai-source:hover { color: var(--ai-forest); text-decoration-color: var(--ai-forest); }
.ai-tools { display: flex; gap: 2px; margin-left: auto; }
.ai-tool {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--ai-ink-faint);
  cursor: pointer;
  transition: color .2s, background .2s;
}
.ai-tool svg { width: 16px; height: 16px; }
.ai-tool:hover { color: var(--ai-forest); background: var(--ai-cream); }
.ai-tool.is-done { color: var(--ai-green); }

/* While AI Mode looks for an answer: the workshop scanner from the home page, in miniature. */
.ai-scan {
  padding: 2px 0 2px 16px;
  border-left: 1px solid rgba(47,70,62,.22);
  font: 400 12px/1.95 'DM Mono', ui-monospace, monospace;
  color: rgba(47,70,62,.78);
}
.ai-scan li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  max-width: 360px;
  list-style: none;
  animation: ai-rise .35s ease both;
}
.ai-scan__prefix { flex: none; color: rgba(47,70,62,.32); }
.ai-scan__val { margin-left: auto; padding-left: 16px; color: var(--ai-green); font-weight: 500; white-space: nowrap; }
.ai-scan__cursor {
  display: inline-block;
  align-self: center;
  width: 7px;
  height: 12px;
  background: var(--ai-forest);
  animation: ai-blink 1.1s step-end infinite;
}
@keyframes ai-blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }

/* The composer. */
.ai-dock {
  position: relative;
  flex: none;
  width: 100%;
  max-width: calc(720px + 2 * var(--ai-gutter));
  margin: 0 auto;
  padding: 10px var(--ai-gutter) 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.ai-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 8px 8px 22px;
  border: 1px solid var(--ai-border-dk);
  border-radius: 30px;
  background: #fff;
  box-shadow: 0 22px 44px -28px rgba(47,70,62,.45), 0 1px 2px rgba(47,70,62,.05);
  transition: border-color .25s, box-shadow .25s;
}
.ai-composer:focus-within {
  border-color: rgba(47,70,62,.42);
  box-shadow: 0 0 0 4px rgba(247,207,191,.55), 0 22px 44px -28px rgba(47,70,62,.45);
}
.ai-composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 168px;
  padding: 10px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: none;
  font-size: 15.5px;
  font-weight: 300;
  line-height: 1.55;
  color: var(--ai-forest);
}
.ai-composer textarea::placeholder { color: var(--ai-ink-faint); opacity: 1; }
.ai-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ai-forest);
  color: #fff;
  cursor: pointer;
  transition: background .2s, transform .2s var(--ai-ease), opacity .2s;
}
.ai-send svg { width: 18px; height: 18px; stroke-width: 1.8; }
.ai-send:not(:disabled):hover { background: var(--ai-forest-dk); transform: translateY(-1px); }
.ai-send:disabled { background: var(--ai-blush-lt); color: rgba(47,70,62,.35); cursor: default; }
.ai-stop span { display: block; width: 12px; height: 12px; border-radius: 3px; background: currentColor; }

/* Ways in: before the first question, as chips under the composer. */
.ai-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 660px;
  margin: 20px auto 0;
}
.ai-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 13px;
  border: 1px solid var(--ai-border-dk);
  border-radius: 100px;
  background: rgba(255,255,255,.75);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--ai-forest);
  cursor: pointer;
  animation: ai-rise .5s var(--ai-ease) both;
  transition: background .2s, border-color .2s, transform .2s var(--ai-ease);
}
.ai-chip svg { width: 15px; height: 15px; opacity: .7; }
.ai-chip:hover { background: var(--ai-blush-lt); border-color: rgba(47,70,62,.28); transform: translateY(-1px); }
.ai-chip:nth-child(2) { animation-delay: .04s; }
.ai-chip:nth-child(3) { animation-delay: .08s; }
.ai-chip:nth-child(4) { animation-delay: .12s; }
.ai-chip:nth-child(5) { animation-delay: .16s; }
.ai-chip:nth-child(6) { animation-delay: .2s; }
.ai-chip:nth-child(7) { animation-delay: .24s; }
.has-messages .ai-chips { display: none; }

.ai-fine {
  margin: 12px 0 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.6;
  color: var(--ai-ink-faint);
}
.ai-fine a {
  color: var(--ai-ink-light);
  text-decoration: underline;
  text-decoration-color: var(--ai-blush);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.ai-fine a:hover { color: var(--ai-forest); text-decoration-color: var(--ai-forest); }

/* Back to the latest answer, after scrolling up. */
.ai-down {
  position: absolute;
  left: 50%;
  top: -46px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--ai-border-dk);
  border-radius: 50%;
  background: #fff;
  color: var(--ai-forest);
  box-shadow: 0 8px 22px -10px rgba(47,70,62,.4);
  cursor: pointer;
  transform: translateX(-50%);
  animation: ai-rise .3s var(--ai-ease) both;
}
.ai-down svg { width: 16px; height: 16px; }

.ai-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── SHORTER SCREENS: a tighter welcome, so the composer and its chips always fit. ── */
@media (max-height: 800px) and (min-width: 641px) {
  .ai-top { height: 64px; }
  .ai-welcome { padding-bottom: 22px; }
  .ai-welcome__mark { width: 58px; height: 58px; margin-bottom: 20px; box-shadow: 0 0 0 8px rgba(247,207,191,.38), 0 0 0 1px rgba(47,70,62,.1), 0 18px 40px -18px rgba(47,70,62,.45); }
  .ai-eyebrow { margin-bottom: 10px; }
  .ai-welcome h2 { font-size: clamp(28px, 3.4vw, 38px); margin-bottom: 10px; }
  .ai-chips { margin-top: 16px; }
}

/* ── TABLETS ── */
@media (max-width: 860px) {
  .ai-dialog {
    width: calc(100vw - 28px);
    height: calc(100vh - 28px);
    height: calc(100dvh - 28px);
    border-radius: 22px;
  }
}

/* ── PHONES: a full-screen sheet that slides up, with the composer at the bottom. ── */
@media (max-width: 640px) {
  .ai-dialog {
    inset: 0 0 auto;
    width: 100%;
    height: 100%;
    height: var(--ai-vh, 100dvh);
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .ai-dialog[open] { animation: ai-sheet-in .46s var(--ai-ease) both; }
  .ai-dialog[open].is-closing { animation: ai-sheet-out .3s cubic-bezier(.4,0,.6,1) both; }
  .ai-top { height: 62px; padding: 0 10px 0 16px; }
  .ai-brand { gap: 10px; }
  .ai-brand .ai-avatar { width: 32px; height: 32px; box-shadow: 0 0 0 3px rgba(247,207,191,.55); }
  .ai-brand__title { font-size: 18px; }
  .ai-new { width: 40px; height: 40px; padding: 0; justify-content: center; border-color: var(--ai-border); }
  .ai-new span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

  .ai-dialog:not(.has-messages) .ai-scroll { flex: 1; margin-top: 0; display: flex; flex-direction: column; justify-content: center; }
  .ai-dialog:not(.has-messages) .ai-dock { margin-bottom: 0; }
  .ai-welcome { padding-bottom: 12px; }
  .ai-welcome__mark { width: 60px; height: 60px; margin-bottom: 22px; }
  .ai-welcome h2 { font-size: 31px; }
  .ai-welcome p { font-size: 14px; }

  .ai-messages { gap: 26px; padding-top: 20px; }
  .ai-message--assistant { grid-template-columns: 30px minmax(0, 1fr); column-gap: 12px; }
  .ai-message--assistant > .ai-avatar { width: 30px; height: 30px; box-shadow: 0 0 0 3px rgba(247,207,191,.55); }
  .ai-body { padding-top: 2px; }
  .ai-question { max-width: 88%; }

  /* The chips sit above the composer and scroll sideways. */
  .ai-dock { display: flex; flex-direction: column; padding-top: 6px; }
  .ai-chips {
    order: -1;
    flex-wrap: nowrap;
    justify-content: flex-start;
    max-width: none;
    margin: 0 calc(-1 * var(--ai-gutter)) 12px;
    padding: 2px var(--ai-gutter);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask: linear-gradient(90deg, transparent, #000 var(--ai-gutter), #000 calc(100% - var(--ai-gutter)), transparent);
    mask: linear-gradient(90deg, transparent, #000 var(--ai-gutter), #000 calc(100% - var(--ai-gutter)), transparent);
  }
  .ai-chips::-webkit-scrollbar { display: none; }
  .ai-chip { flex: none; }
  .ai-composer { padding-left: 18px; border-radius: 26px; }
  .ai-composer textarea { font-size: 16px; }   /* 16px keeps iOS from zooming in */
  .ai-fine { margin-top: 10px; font-size: 10.5px; }
}
@keyframes ai-sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes ai-sheet-out { from { transform: none; } to { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  .nav-ai { animation: none; }
  .ai-dialog[open], .ai-dialog[open]::backdrop, .ai-dialog[open].is-closing,
  .ai-message, .ai-actions, .ai-foot, .ai-chip, .ai-scan li, .ai-down { animation: none; }
  .ai-caret, .ai-brand__status::before { animation: none; }
}
