/* ═══════════════════════════════════════════════════════════════════════════
   ai-tools.css — Unified "AI Tools" design language (2026-06-28)
   ---------------------------------------------------------------------------
   One family across the three AI-tool surfaces that used to read as three
   different products:
     1. Models-grid launcher cards  .hh-tool-card        (src/ui/models-grid.js)
     2. Hub preset tool cards       .guide-tool-card       (src/hub-base.js)
     3. Chat specialist headers     .ai-expert-header    (src/app-main.js)

   This file owns the SHARED primitives — the accent contract, the gradient
   accent-bar, the medallion glow, and the launcher "open" affordance. Each
   surface's own module (hydro-dashboards.css / tool-card.css / chat-experts.css)
   keeps its structural layout and refines to the same spec.

   Loaded AFTER the three base per-surface modules but BEFORE tool-glass.css, so
   tool-glass still wins for the launcher glass surface while these family rules
   sit above the base files. 100% token-driven (literal fallbacks only); dark-
   aware via the [data-theme="dark"] --guide-* flips; honors prefers-reduced-motion.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Accent contract ───────────────────────────────────────────────────
   Every AI-tool surface resolves ONE accent (--ait-accent) from whatever
   per-instance custom property it already sets, then derives every decoration
   from it via color-mix(). Final fallback is Montana blue (never the hero red). */
.hh-tool-card    { --ait-accent: var(--tool-accent, var(--guide-color-mt-blue, #3B5A7A)); }
.hh-sci-modal-card { --ait-accent: var(--tool-accent, var(--guide-color-mt-blue, #3B5A7A)); }
.guide-tool-card   { --ait-accent: var(--preset-color, var(--guide-color-mt-blue, #3B5A7A)); }
.ai-expert-header { --ait-accent: var(--expert-color, var(--guide-color-mt-blue, #3B5A7A)); }

/* The shared gradient accent-bar — a hairline that FADES rather than a flat
   block (borrowed from .hh-sci-modal-card::before). Used by every surface's
   ::before. Defined once, references the per-element --ait-accent above. */
.hh-tool-card,
.hh-sci-modal-card,
.guide-tool-card,
.ai-expert-header {
  --ait-bar: linear-gradient(90deg,
    var(--ait-accent) 0%,
    color-mix(in srgb, var(--ait-accent) 35%, transparent) 45%,
    transparent 82%);
  /* Reusable glow + ring values so hover halos match across surfaces. */
  --ait-ring: 0 0 0 1px color-mix(in srgb, var(--ait-accent) 22%, transparent);
  --ait-glow-sm: 0 4px 14px color-mix(in srgb, var(--ait-accent) 18%, transparent);
  --ait-glow-lg: 0 8px 26px color-mix(in srgb, var(--ait-accent) 22%, transparent);
}

/* ── 2. Shared medallion glow ─────────────────────────────────────────────
   One icon-container treatment: accent-tinted fill, hairline ring, soft glow.
   Each surface keeps its own size + border-radius (rounded square for tools,
   circle for the expert avatar via its own module). Launcher .hh-tool-card__
   medallion is re-stated by tool-glass.css with identical values — harmless,
   it just wins the cascade with the same result. */
.hh-tool-card__medallion,
.guide-tool-card__icon {
  color: var(--ait-accent);
  background: color-mix(in srgb, var(--ait-accent) 14%, transparent);
  box-shadow: var(--ait-ring), var(--ait-glow-sm);
}

/* ═══════════════════════════════════════════════════════════
   AI DIALOG CONTENT — body styling for guideDialog() panels
   raised by ai-service.js (_showInfoPanel / _showReportPanel /
   _showComparisonPanel / _showAnalysisResult).

   These replaced inline style="…" strings that shipped alongside
   the old <calcite-dialog> elements. Calcite was never loaded, so
   the inline styles were the only thing rendering at all.
   ═══════════════════════════════════════════════════════════ */
.ai-dlg-prose {
  padding: var(--guide-sp-4) var(--guide-sp-5);
  line-height: 1.7;
  font-size: var(--guide-fs-14);
}
.ai-dlg-h {
  margin: var(--guide-sp-4) 0 var(--guide-sp-2);
  color: var(--guide-color-mt-gold);
  font-size: var(--guide-fs-16);
}
.ai-dlg-sec { margin-bottom: var(--guide-sp-3); }
.ai-dlg-code {
  background: var(--bg-3);
  padding: 2px 5px;
  border-radius: var(--guide-radius-xs);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}
.ai-dlg-foot {
  margin-top: var(--guide-sp-5);
  padding-top: var(--guide-sp-3);
  border-top: 1px solid var(--border-default);
  font-size: var(--guide-fs-12);
  color: var(--text-muted);
  text-align: center;
}

/* Report stat grid */
.ai-dlg-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--guide-sp-2);
  margin: var(--guide-sp-3) 0;
}
.ai-dlg-stat {
  background: var(--bg-3);
  border: 1px solid var(--border-default);
  border-radius: var(--guide-radius-md);
  padding: var(--guide-sp-2) var(--guide-sp-3);
  text-align: center;
}
.ai-dlg-stat-label {
  font-size: var(--guide-fs-11);
  color: var(--text-tertiary);
  text-transform: var(--guide-label-case, uppercase);
  letter-spacing: 0.5px;
}
.ai-dlg-stat-value {
  font-size: var(--guide-fs-20);
  font-weight: var(--guide-fw-bold, 700);
  color: var(--text-primary);
  margin-top: 2px;
}

/* Comparison table */
.ai-dlg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--guide-fs-14);
}
.ai-dlg-table thead tr { border-bottom: 2px solid var(--border-strong, var(--border-default)); }
.ai-dlg-table th {
  padding: var(--guide-sp-2);
  color: var(--text-muted);
  text-align: center;
}
.ai-dlg-table th:first-child { text-align: left; }
.ai-dlg-table th.ai-dlg-col-a { color: var(--guide-color-mt-gold); }
.ai-dlg-table th.ai-dlg-col-b { color: var(--guide-color-mt-blue); }
.ai-dlg-table tbody tr { border-bottom: 1px solid var(--border-subtle); }
.ai-dlg-table td {
  padding: var(--guide-sp-2);
  color: var(--text-primary);
  text-align: center;
}
.ai-dlg-table td:first-child { text-align: left; }

/* Analysis status pill — colour resolved from the data-status attribute
   rather than an inline colour string, so dark mode can re-anchor it. */
.ai-dlg-status {
  display: inline-block;
  padding: 3px 12px;
  font-size: var(--guide-fs-11);
  font-weight: var(--guide-fw-bold, 700);
  text-transform: var(--guide-label-case, uppercase);
  letter-spacing: 0.5px;
  border-radius: var(--guide-radius-pill);
  margin-bottom: var(--guide-sp-3);
  color: var(--ai-dlg-status-c, var(--text-muted));
  background: color-mix(in srgb, var(--ai-dlg-status-c, var(--text-muted)) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--ai-dlg-status-c, var(--text-muted)) 25%, transparent);
}
.ai-dlg-status[data-status="pass"]    { --ai-dlg-status-c: var(--guide-color-status-ok); }
.ai-dlg-status[data-status="fail"]    { --ai-dlg-status-c: var(--guide-color-status-crit); }
.ai-dlg-status[data-status="warning"] { --ai-dlg-status-c: var(--guide-color-status-warn); }

/* ═══════════════════════════════════════════════════════════
   GEOAI SPATIAL ACTIONS — replaces the inline style="…" grid and
   the inline onmouseenter/onmouseleave hover swap in geoai.js.
   The <calcite-icon> these carried never rendered; they are Lucide
   placeholders now, hydrated by renderResults().
   ═══════════════════════════════════════════════════════════ */
.geoai-spatial-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--guide-sp-2);
  margin-top: var(--guide-sp-3);
}
.geoai-spatial-action {
  display: flex;
  align-items: flex-start;
  gap: var(--guide-sp-2);
  padding: var(--guide-sp-3);
  background: var(--bg-3);
  border: 1px solid var(--border-default);
  border-radius: var(--guide-radius-md);
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: background var(--guide-dur-fast) var(--guide-ease-out),
    border-color var(--guide-dur-fast) var(--guide-ease-out);
}
.geoai-spatial-action:hover {
  background: var(--bg-2);
  border-color: var(--border-strong);
}
.geoai-spatial-action__ico {
  flex-shrink: 0;
  margin-top: 2px;
  width: 16px;
  height: 16px;
  color: var(--guide-color-mt-blue);
}
.geoai-spatial-action__label {
  font-weight: var(--guide-fw-semi, 600);
  font-size: var(--guide-fs-13);
}
.geoai-spatial-action__desc {
  font-size: var(--guide-fs-12);
  color: var(--text-tertiary);
  margin-top: 2px;
}

@media (max-width: 480px) {
  .geoai-spatial-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════
   NOTEBOOK DIALOG BODY — shared by skill-registry.js and geoai.js
   ═══════════════════════════════════════════════════════════ */
.nb-code {
  background: var(--bg-3);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  padding: var(--guide-sp-4);
  border-radius: var(--guide-radius-sm);
  overflow: auto;
  font-size: var(--guide-fs-13);
  white-space: pre-wrap;
  max-height: 60vh;
}
.nb-actions {
  margin-top: var(--guide-sp-4);
  display: flex;
  gap: var(--guide-sp-2);
}

/* ═══════════════════════════════════════════════════════════
   SKILL REGISTRY — execution panel + library rows.
   Was a <calcite-panel> (never registered) positioned by an
   inline style="…" cssText string.
   ═══════════════════════════════════════════════════════════ */
.skill-exec-panel {
  position: absolute;
  top: var(--guide-sp-3);
  right: var(--guide-sp-3);
  z-index: var(--guide-z-sticky);
  width: 380px;
  max-width: calc(100vw - 2 * var(--guide-sp-3));
  max-height: 80vh;
  overflow-y: auto;
  border-radius: var(--guide-radius-lg);
  border: 1px solid var(--border-default);
  box-shadow: var(--guide-shadow-overlay);
}
.skill-exec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--guide-sp-2);
  padding: var(--guide-sp-3) var(--guide-sp-4);
  border-bottom: 1px solid var(--border-default);
}
.skill-exec-title {
  font-size: var(--guide-fs-14);
  font-weight: var(--guide-fw-bold, 700);
  margin: 0;
}
.skill-exec-body { padding: var(--guide-sp-4); }
.skill-exec-desc {
  margin: 0 0 var(--guide-sp-3);
  color: var(--text-secondary);
  font-size: var(--guide-fs-14);
}
.skill-exec-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--guide-sp-1);
  margin: var(--guide-sp-2) 0;
}
.skill-tag {
  font-size: var(--guide-fs-12);
  padding: 2px var(--guide-sp-2);
  border-radius: var(--guide-radius-xs);
}
/* No status-info-bg token exists; derive the tint from the info hue so both
   themes track it automatically rather than inventing a one-off token. */
.skill-tag--cat {
  background: color-mix(in srgb, var(--guide-color-status-info) 12%, transparent);
  color: var(--guide-color-status-info);
}
.skill-tag--gee {
  background: var(--guide-color-status-warn-bg);
  color: var(--guide-color-status-warn);
}
.skill-exec-result {
  margin: var(--guide-sp-4) 0;
  min-height: 60px;
  background: var(--bg-3);
  border-radius: var(--guide-radius-sm);
  padding: var(--guide-sp-3);
  font-size: var(--guide-fs-13);
}
.skill-exec-json { white-space: pre-wrap; font-size: var(--guide-fs-12); margin: 0; }
.skill-exec-error { color: var(--guide-color-status-crit); }
.skill-exec-actions {
  display: flex;
  gap: var(--guide-sp-2);
  margin-top: var(--guide-sp-4);
}
.skill-exec-meta {
  margin: var(--guide-sp-3) 0 0;
  font-size: var(--guide-fs-12);
  color: var(--text-muted);
}

.skill-lib-list { max-height: 70vh; overflow-y: auto; }
.skill-lib-empty {
  color: var(--text-secondary);
  text-align: center;
  padding: var(--guide-sp-7);
}
.skill-lib-row {
  display: flex;
  align-items: center;
  gap: var(--guide-sp-3);
  padding: var(--guide-sp-3);
  border-bottom: 1px solid var(--border-subtle);
}
.skill-lib-icon {
  display: inline-flex;
  color: var(--guide-color-mt-blue);
}
.skill-lib-icon [data-lucide] { width: 20px; height: 20px; }
.skill-lib-main { flex: 1; min-width: 0; }
.skill-lib-desc { font-size: var(--guide-fs-13); color: var(--text-secondary); }
.skill-lib-meta { font-size: var(--guide-fs-12); color: var(--text-muted); margin-top: 2px; }
