/* ==========================================================================
   KuduDoc AI — ai.html only.
   Everything shared (.container, .card, .chip, .btn, .feature-grid,
   .industry-grid, .doc-window, .icon, .cta-band__row …) comes from
   components.css; this file only adds what the AI page needs, all prefixed
   .ai-. Design tokens only — no raw hex anywhere below.
   ========================================================================== */

/* ---- Section head (site-wide pattern, but each page-level stylesheet owns
   its own copy — there is no shared partial system in this prototype). ---- */
.section-head{ max-width: 660px; margin-bottom: var(--space-8); }

/* ---- Roadmap legend — the "* in build, not live yet" line ---- */
.ai-roadmap-legend{
  margin-top: var(--space-5);
  font-size: var(--text-micro);
  color: var(--text-tertiary);
}
.ai-roadmap-legend a{ color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.ai-roadmap-legend a:hover{ color: var(--blue-600); }
.ai-roadmap-legend--center{ text-align: center; }

/* ==========================================================================
   HERO
   ========================================================================== */
.ai-hero{ position: relative; overflow: hidden; }
.ai-hero__cta{ margin-top: var(--space-7); display: flex; gap: var(--space-4); flex-wrap: wrap; }
.ai-hero__note{ margin-top: var(--space-5); font-size: var(--text-small); color: rgba(255,255,255,0.8); }
.ai-hero-doc{ max-width: 480px; margin-inline: auto; text-align: left; }

/* ==========================================================================
   CHAT — used by the hero mock and the "when it doesn't know" mock. The live
   demo reuses the same bubbles via .ai-ask__thread.
   ========================================================================== */
.ai-chat{ display: flex; flex-direction: column; gap: var(--space-3); }
.ai-chat__bubble{
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-small);
  line-height: var(--leading-normal);
  max-width: 92%;
}
.ai-chat__bubble--q{
  background: var(--ink-50);
  color: var(--ink-900);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  font-weight: 600;
}
.ai-chat__bubble--a{
  background: var(--blue-50);
  color: var(--ink-900);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  max-width: 100%;
}
.ai-chat__bubble--a strong{ font-weight: 700; }

/* ---- Citation block inside an answer ---- */
.ai-cite{
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--blue-200);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
.ai-cite__doc{
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--text-micro); font-weight: 700; color: var(--blue-700);
  min-width: 0;
}
.ai-cite__doc svg{ width: 15px; height: 15px; flex-shrink: 0; }
.ai-cite__ref{ font-size: var(--text-micro); color: var(--text-tertiary); font-weight: 600; }
.ai-cite__quote{
  font-size: var(--text-micro);
  line-height: 1.65;
  color: var(--ink-700);
  font-style: italic;
  padding-left: var(--space-4);
  border-left: 2px solid var(--blue-300);
}
.ai-cite__quote mark{ background: var(--orange-100); color: var(--ink-900); border-radius: 3px; padding: 0 3px; font-style: normal; font-weight: 600; }
.ai-cite__chip{ margin-top: 2px; }
.ai-cite--empty{ border-top-color: var(--ink-200); }
.ai-cite--empty .ai-cite__doc{ color: var(--text-tertiary); }

/* ---- The line under the hero answer ---- */
.ai-caveat{
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: var(--space-5); padding-top: var(--space-4);
  border-top: var(--border-hairline);
  font-size: var(--text-micro); line-height: 1.6; color: var(--text-tertiary);
}
.ai-caveat svg{ width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; color: var(--blue-600); }

/* ==========================================================================
   FEATURE-CARD MOCKS — the four small visuals in "Four things AI does"
   ========================================================================== */
.ai-mock-head{
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4);
}
.ai-mock-head .ai-mock-label{ margin-bottom: 0; }
.ai-mock-label{
  display: block; margin-bottom: var(--space-4);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow); color: var(--text-tertiary);
}
.ai-mock-foot{
  margin-top: var(--space-4); padding-top: var(--space-3);
  border-top: var(--border-hairline);
  font-size: var(--text-micro); color: var(--text-tertiary);
}

/* ---- 1. Summarise ---- */
.ai-sum{ display: flex; flex-direction: column; gap: var(--space-3); }
.ai-sum li{
  display: flex; align-items: flex-start; gap: 9px;
  font-size: var(--text-micro); color: var(--ink-700); line-height: 1.6;
}
.ai-sum li::before{
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue-500); flex-shrink: 0; margin-top: 7px;
}

/* ---- 2. Classify and file ---- */
.ai-route{ display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.ai-route__file,
.ai-route__shelf{
  display: flex; align-items: center; gap: 8px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-micro); font-weight: 600; color: var(--ink-900);
  min-width: 0;
}
.ai-route__file{ background: var(--ink-50); border: var(--border-hairline); }
.ai-route__file svg,
.ai-route__shelf svg{ width: 16px; height: 16px; flex-shrink: 0; color: var(--blue-600); }
.ai-route__file{ overflow: hidden; }
.ai-route__arrow{ display: flex; justify-content: center; color: var(--orange-500); }
.ai-route__arrow svg{ width: 18px; height: 18px; }
.ai-route__shelf{ background: var(--blue-50); border: 1px solid var(--blue-200); }
.ai-route__shelf-path{ display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.ai-route__shelf .chip{ margin-left: auto; flex-shrink: 0; }
.ai-tags{ display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }

/* ---- 3. Extract the dates ---- */
.ai-kv{
  display: flex; justify-content: space-between; gap: var(--space-3);
  font-size: var(--text-small); padding-block: var(--space-2);
}
.ai-kv + .ai-kv{ border-top: 1px dashed var(--ink-100); }
.ai-kv__k{ color: var(--text-tertiary); }
.ai-kv__v{ font-weight: 600; color: var(--ink-900); text-align: right; }
.ai-kv__v--found{
  color: var(--blue-700);
  background: var(--blue-50);
  border-radius: var(--radius-sm);
  padding: 1px 8px;
  white-space: nowrap; /* keep the extracted date on one line — it's the point of the mock */
}
.ai-fired{
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: var(--space-4); padding: var(--space-3) var(--space-4);
  background: var(--success-50); border-radius: var(--radius-md);
  font-size: var(--text-micro); line-height: 1.6; color: var(--ink-900);
}
.ai-fired svg{ width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; color: var(--success-700); }
.ai-fired strong{ color: var(--success-700); }

/* ---- 4. Flag the obligations ---- */
.ai-flag{
  display: flex; align-items: center; gap: var(--space-3);
  padding-block: var(--space-3); flex-wrap: wrap;
}
.ai-flag + .ai-flag{ border-top: var(--border-hairline); }
.ai-flag__body{ display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ai-flag__name{ font-size: var(--text-small); font-weight: 600; color: var(--ink-900); }
.ai-flag__sub{ font-size: var(--text-micro); color: var(--text-tertiary); line-height: 1.5; }
.ai-flag > .chip{ margin-left: auto; flex-shrink: 0; }

/* ==========================================================================
   THE ASK DEMO — the centrepiece
   ========================================================================== */
.ai-ask{ max-width: 880px; margin-inline: auto; }
.ai-ask__window{ background: var(--white); }
.ai-ask__body{
  min-height: 330px;
  display: flex;
  padding: var(--space-6);
}
.ai-ask__thread{ width: 100%; display: flex; flex-direction: column; gap: var(--space-4); }

/* ---- Resting state ---- */
.ai-ask__empty{
  margin: auto; text-align: center; max-width: 400px;
  padding-block: var(--space-6);
}
.ai-ask__empty-icon{
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: var(--radius-md);
  background: var(--blue-50); color: var(--blue-600); margin-bottom: var(--space-4);
}
.ai-ask__empty-icon svg{ width: 24px; height: 24px; }
.ai-ask__empty-title{ font-family: var(--font-display); font-weight: 600; font-size: var(--text-h4); color: var(--ink-900); }
.ai-ask__empty-sub{ margin-top: var(--space-2); font-size: var(--text-small); color: var(--text-secondary); line-height: var(--leading-normal); }

/* ---- Thinking beat ---- */
.ai-ask__thinking{
  display: inline-flex; align-items: center; gap: 10px;
  align-self: flex-start;
  padding: var(--space-3) var(--space-4);
  background: var(--blue-50); border-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
  font-size: var(--text-micro); font-weight: 600; color: var(--blue-700);
  animation: ai-pop-in var(--dur-base) var(--ease-out) both;
}
.ai-ask__dots{ display: inline-flex; gap: 4px; flex-shrink: 0; }
.ai-ask__dots i{
  display: block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue-500);
  animation: ai-blink 1s var(--ease-in-out) infinite;
}
.ai-ask__dots i:nth-child(2){ animation-delay: 160ms; }
.ai-ask__dots i:nth-child(3){ animation-delay: 320ms; }

@keyframes ai-blink{
  0%, 60%, 100%{ opacity: .25; transform: translateY(0); }
  30%{ opacity: 1; transform: translateY(-2px); }
}
@keyframes ai-pop-in{
  from{ opacity: 0; transform: translateY(6px); }
  to{ opacity: 1; transform: none; }
}

/* ---- Answer ---- */
.ai-ask__answer{ animation: ai-pop-in var(--dur-slow) var(--ease-out) both; }
.ai-ask__answer p{ font-size: var(--text-small); line-height: var(--leading-normal); }
.ai-ask__answer p + p{ margin-top: var(--space-3); }

/* Rows — the multi-document answers (auto-renewals, supplier affidavits) */
.ai-ask__rows{
  margin-top: var(--space-4);
  border-top: 1px solid var(--blue-200);
}
.ai-ask__row{
  display: flex; align-items: center; gap: var(--space-3);
  padding-block: var(--space-3); flex-wrap: wrap;
}
.ai-ask__row + .ai-ask__row{ border-top: 1px solid var(--blue-200); }
.ai-ask__row-body{ display: flex; flex-direction: column; min-width: 0; flex: 1 1 200px; }
.ai-ask__row-name{ font-size: var(--text-micro); font-weight: 700; color: var(--ink-900); overflow-wrap: anywhere; }
.ai-ask__row-sub{ font-size: var(--text-micro); color: var(--text-secondary); line-height: 1.5; }
.ai-ask__row > .chip{ margin-left: auto; flex-shrink: 0; }

/* The confidence-ish note under every answer */
.ai-ask__note{
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: var(--space-4); padding-top: var(--space-3);
  border-top: var(--border-hairline);
  font-size: var(--text-micro); line-height: 1.6; color: var(--text-tertiary);
}
.ai-ask__note svg{ width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; color: var(--blue-600); }

/* ---- Composer / preset chips ---- */
.ai-ask__composer{ margin-top: var(--space-5); }
.ai-ask__composer-label{
  display: flex; align-items: center; gap: 7px;
  font-size: var(--text-micro); font-weight: 700; text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow); color: var(--blue-700);
  margin-bottom: var(--space-3);
}
.ai-ask__composer-label svg{ width: 15px; height: 15px; color: var(--orange-500); }
.ai-ask__chips{ display: flex; flex-wrap: wrap; gap: var(--space-3); }
.ai-ask__chip{
  font-family: var(--font-sans);
  font-size: var(--text-small); font-weight: 600; line-height: 1.35;
  text-align: left;
  color: var(--blue-700);
  background: var(--white);
  border: 1.5px solid var(--blue-200);
  border-radius: var(--radius-full);
  padding: 0.6rem 1.1rem;
  max-width: 100%;
  transition:
    border-color var(--dur-base) var(--ease-out),
    background-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.ai-ask__chip:hover{ border-color: var(--blue-600); background: var(--blue-50); transform: translateY(-1px); }
.ai-ask__chip:active{ transform: translateY(0) scale(0.99); }
.ai-ask__chip[aria-pressed="true"]{
  background: var(--blue-600); border-color: var(--blue-600); color: var(--white);
}
.ai-ask__foot{
  margin-top: var(--space-4);
  font-size: var(--text-micro);
  color: var(--text-tertiary);
  line-height: 1.6;
}

@media (max-width: 640px){
  .ai-ask__body{ padding: var(--space-4); min-height: 300px; }
  .ai-ask__chips{ flex-direction: column; align-items: stretch; }
  .ai-ask__chip{ border-radius: var(--radius-md); }
  .ai-chat__bubble--q{ max-width: 100%; }
  /* Narrow enough that the chip always wraps — let it sit under the copy,
     left-aligned, instead of stranded on its own right-aligned line. */
  .ai-ask__row,
  .ai-flag{ gap: var(--space-2); }
  .ai-ask__row-body,
  .ai-flag__body{ flex: 1 1 100%; }
  .ai-ask__row > .chip,
  .ai-flag > .chip{ margin-left: 0; }
}

/* ==========================================================================
   TRUST SECTION
   ========================================================================== */
.ai-trust-doc{ max-width: 460px; margin-inline: auto; text-align: left; }

.ai-trust-list{ display: flex; flex-direction: column; gap: var(--space-5); margin-top: var(--space-6); }
.ai-trust-list__item{ display: flex; align-items: flex-start; gap: var(--space-4); }
.ai-trust-list__icon{
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--blue-50); color: var(--blue-600);
  display: flex; align-items: center; justify-content: center;
}
.ai-trust-list__icon svg{ width: 20px; height: 20px; }
.ai-trust-list__body{ display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ai-trust-list__label{ font-size: var(--text-body); font-weight: 700; color: var(--ink-900); }
.ai-trust-list__sub{ font-size: var(--text-small); color: var(--text-secondary); line-height: var(--leading-normal); }

.ai-callout{
  margin-top: var(--space-6);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--orange-50);
  border-left: 3px solid var(--orange-500);
  font-size: var(--text-small);
  line-height: var(--leading-normal);
  color: var(--ink-900);
}
.ai-callout strong{ color: var(--orange-700); }
.ai-callout a{ color: var(--blue-600); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.ai-callout a:hover{ color: var(--blue-700); }

/* ==========================================================================
   PLANS NOTE
   ========================================================================== */
.ai-plans{
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-7); flex-wrap: wrap;
  padding: var(--space-7);
  border-radius: var(--radius-xl);
  background: var(--blue-50);
}
.ai-plans__body{ flex: 1 1 420px; min-width: 0; }
.ai-plans__kicker{
  font-size: var(--text-micro); font-weight: 700; text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow); color: var(--blue-700);
  margin-bottom: var(--space-3);
}
.ai-plans__text{ font-size: var(--text-body); line-height: var(--leading-normal); color: var(--text-secondary); }
.ai-plans__text strong{ color: var(--ink-900); font-weight: 700; }
.ai-plans__actions{ display: flex; gap: var(--space-3); flex-wrap: wrap; }

@media (max-width: 560px){
  .ai-plans{ padding: var(--space-6); }
  .ai-plans__actions .btn{ flex: 1 1 100%; }
}

/* ==========================================================================
   "Where it shows up" — the industry cards use a non-link .link-arrow inside
   an <a>, so it needs the hover-nudge wired to the card instead.
   ========================================================================== */
.industry-card:hover .link-arrow svg{ transform: translateX(3px); }
