/* Super AI pages. Loaded after /operations/operations.css, which provides the
   fonts, palette, nav, header and chip index. */

.ai-main { padding: 10px 60px 0; max-width: 1100px; }
.ai-section { padding: 46px 0 10px; scroll-margin-top: 240px; }
.ai-section > h2 {
  font-family: 'Space Grotesk', sans-serif; font-size: clamp(24px, 3vw, 34px);
  font-weight: 700; letter-spacing: -0.02em; margin-bottom: 18px;
}
.ai-section > p, .ai-lead { color: var(--white-dim); font-size: 16.5px; line-height: 1.75; max-width: 820px; margin-bottom: 16px; }
.ai-section h3 { font-family: 'Space Grotesk', sans-serif; font-size: 17px; font-weight: 600; margin-bottom: 8px; }

/* How it works: numbered steps */
.ai-steps { list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ai-steps li {
  counter-increment: step; background: var(--navy-card); border: 1px solid var(--navy-border);
  border-radius: 12px; padding: 20px 22px;
}
.ai-steps li::before {
  content: counter(step, decimal-leading-zero); display: block; margin-bottom: 10px;
  font-family: 'Space Mono', monospace; font-size: 12px; letter-spacing: 0.1em; color: var(--cyan);
}
.ai-steps p { color: var(--white-dim); font-size: 14.5px; line-height: 1.65; }

/* Key concepts */
.ai-terms { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px 28px; }
.ai-terms div { border-left: 2px solid var(--cobalt); padding: 4px 0 4px 16px; }
.ai-terms dt { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.ai-terms dd { color: var(--white-dim); font-size: 14.5px; line-height: 1.65; }

/* Tools and tag chips */
.ai-tool-groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ai-tool-groups.cols-2 { grid-template-columns: repeat(2, 1fr); }
.ai-tool-groups > div { background: var(--navy-card); border: 1px solid var(--navy-border); border-radius: 12px; padding: 20px 22px; }
.ai-tool-groups h3 {
  font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 400; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--cyan); margin-bottom: 12px;
}
.ai-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.ai-tags li {
  font-family: 'Space Mono', monospace; font-size: 12px; color: var(--white-dim);
  background: rgba(37, 99, 255, 0.1); border: 1px solid rgba(37, 99, 255, 0.28);
  border-radius: 5px; padding: 4px 10px;
}

/* Skills checklist and pitfalls */
.ai-checklist, .ai-pitfalls { list-style: none; max-width: 860px; }
.ai-checklist li, .ai-pitfalls li {
  position: relative; padding: 10px 0 10px 32px; border-bottom: 1px solid var(--navy-border);
  color: var(--white-dim); font-size: 15px; line-height: 1.65;
}
.ai-checklist li::before, .ai-pitfalls li::before { position: absolute; left: 4px; top: 10px; font-weight: 700; }
.ai-checklist li::before { content: '✓'; color: var(--success); }
.ai-pitfalls li::before { content: '!'; color: #f59e0b; left: 8px; }
.ai-checklist strong, .ai-pitfalls strong { color: var(--white); font-weight: 600; }

/* Use-case and topic cards */
.ai-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.ai-grid > div { background: var(--navy-card); border: 1px solid var(--navy-border); border-radius: 12px; padding: 20px 22px; }
.ai-grid p { color: var(--white-dim); font-size: 14.5px; line-height: 1.65; }

.ai-topic-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.ai-topic-card {
  display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit;
  background: var(--navy-card); border: 1px solid var(--navy-border); border-radius: 12px;
  padding: 24px 24px 22px; transition: border-color 0.15s, transform 0.15s;
}
.ai-topic-card:hover { border-color: var(--cobalt); transform: translateY(-2px); }
.ai-topic-num { font-family: 'Space Mono', monospace; font-size: 12px; letter-spacing: 0.1em; color: var(--cyan); }
.ai-topic-card h2 { font-family: 'Space Grotesk', sans-serif; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.ai-topic-card p { color: var(--white-dim); font-size: 14.5px; line-height: 1.65; flex: 1; }

/* Call to action */
.ai-cta {
  margin-top: 20px; padding: 32px 34px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(37, 99, 255, 0.16), rgba(0, 229, 255, 0.06));
  border: 1px solid rgba(37, 99, 255, 0.35);
}
.ai-cta h2 { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; margin-bottom: 10px; }
.ai-cta p { color: var(--white-dim); font-size: 16px; line-height: 1.7; max-width: 760px; margin-bottom: 20px; }
.ai-btn {
  display: inline-block; background: var(--cobalt); color: var(--white); text-decoration: none;
  font-weight: 600; font-size: 15px; padding: 12px 22px; border-radius: 8px; transition: background 0.2s;
}
.ai-btn:hover { background: var(--cobalt-light); }
.ai-cta .ai-cta-note { margin: 14px 0 0; font-size: 14px; color: var(--muted-light); }

/* Previous / next topic */
.ai-pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 40px; flex-wrap: wrap; }
.ai-pager a {
  flex: 1 1 260px; text-decoration: none; background: var(--navy-card); border: 1px solid var(--navy-border);
  border-radius: 10px; padding: 16px 20px; color: var(--white); transition: border-color 0.15s;
}
.ai-pager a:hover { border-color: var(--cobalt); }
.ai-pager span { display: block; font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-light); margin-bottom: 4px; }
.ai-pager .next { text-align: right; }

/* Diagrams: inline SVG from scripts/super_ai_diagrams.py, styled here (no inline styles) */
.ai-figure { margin: 0 0 22px; background: var(--navy-mid); border: 1px solid var(--navy-border); border-radius: 14px; padding: 22px 22px 16px; }
.ai-diagram { display: block; width: 100%; height: auto; }
.ai-figure-scroll { overflow-x: auto; }
.ai-figure figcaption { color: var(--muted-light); font-size: 13.5px; margin-top: 12px; }
.dg-box { fill: var(--navy-card); stroke: var(--navy-border); stroke-width: 1.5; }
.dg-box.accent { fill: rgba(37, 99, 255, 0.14); stroke: var(--cobalt); }
.dg-box.cyan { fill: rgba(0, 229, 255, 0.07); stroke: rgba(0, 229, 255, 0.55); }
.dg-box.warn { fill: rgba(245, 158, 11, 0.08); stroke: #f59e0b; }
.dg-box.ok { fill: rgba(16, 185, 129, 0.08); stroke: var(--success); }
.dg-title { fill: var(--white); font-family: 'Space Grotesk', sans-serif; font-size: 15px; font-weight: 600; }
.dg-sub { fill: var(--muted-light); font-family: 'Inter', sans-serif; font-size: 12px; }
.dg-note { fill: var(--muted-light); font-family: 'Inter', sans-serif; font-size: 12px; font-style: italic; }
.dg-mono { fill: #cdd9f0; font-family: 'Space Mono', monospace; font-size: 12px; }
.dg-cap { fill: var(--cyan); font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: 0.1em; }
.dg-chip { fill: var(--navy-card); stroke: var(--navy-border); stroke-width: 1.2; }
.dg-chip.muted { fill: #0b1120; }
.dg-chip.accent { fill: rgba(37, 99, 255, 0.14); stroke: var(--cobalt); }
.dg-chip.ok { fill: rgba(16, 185, 129, 0.1); stroke: var(--success); }
.dg-lane { fill: none; stroke: var(--navy-border); stroke-width: 1.5; stroke-dasharray: 6 5; }
.dg-arrow { fill: none; stroke: var(--muted-light); stroke-width: 1.6; }
.dg-arrow.accent { stroke: var(--cobalt-light); }
.dg-arrow.cyan { stroke: var(--cyan); }
.dg-arrow.warn { stroke: #f59e0b; }
.dg-arrow.dash { stroke-dasharray: 5 4; }
.dg-brace { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.dg-bar { fill: var(--cobalt); }
.dg-bar.cyan { fill: var(--cyan); }
.dg-plot { fill: #0b1120; stroke: var(--navy-border); stroke-width: 1.2; }
.dg-axis { fill: none; stroke: var(--muted); stroke-width: 1.2; }
.dg-dot { fill: var(--cobalt-light); }
.dg-dot.b { fill: var(--cyan); }
.dg-dot.c { fill: var(--muted); }
.dg-near { fill: rgba(59, 123, 255, 0.08); stroke: var(--cobalt-light); stroke-width: 1.2; stroke-dasharray: 4 4; }
.dg-star { fill: #f59e0b; }
.dg-frame { fill: #0b1120; stroke: var(--navy-border); stroke-width: 1.2; }
.dg-noise { fill: var(--muted-light); }
.dg-sun { fill: #f59e0b; }
.dg-hill { fill: var(--cobalt); }
.dg-frozen { fill: rgba(100, 116, 139, 0.18); stroke: var(--muted); stroke-width: 1.2; }
.dg-adapter { fill: rgba(0, 229, 255, 0.35); stroke: var(--cyan); stroke-width: 1.2; }
.dg-seg { stroke-width: 1.2; }
.dg-seg.accent { fill: rgba(37, 99, 255, 0.25); stroke: var(--cobalt); }
.dg-seg.cyan { fill: rgba(0, 229, 255, 0.14); stroke: var(--cyan); }
.dg-seg.ok { fill: rgba(16, 185, 129, 0.16); stroke: var(--success); }
.dg-curve { fill: none; stroke-width: 2.5; }
.dg-curve.train { stroke: var(--cobalt-light); }
.dg-curve.val { stroke: var(--cyan); }
.dg-train-text { fill: var(--cobalt-light); font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 600; }
.dg-val-text { fill: var(--cyan); font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 600; }
.dg-warn-text { fill: #f59e0b; font-family: 'Space Mono', monospace; font-size: 12px; }
.dg-block { fill: #ef4444; font-family: 'Inter', sans-serif; font-size: 18px; font-weight: 700; }

@media (max-width: 1100px) {
  .ai-steps, .ai-tool-groups { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .ai-main { padding: 0 24px; }
  .ai-steps, .ai-tool-groups, .ai-tool-groups.cols-2, .ai-grid, .ai-topic-grid { grid-template-columns: 1fr; }
  .ai-section { scroll-margin-top: 140px; }
  .ai-terms { grid-template-columns: 1fr; }
  .ai-cta { padding: 24px 22px; }
  .ai-figure { padding: 16px 12px 12px; }
  .ai-figure-scroll { overflow-x: auto; }
  .ai-diagram { min-width: 720px; }
}

/* AI Examples: code blocks, tables, ADR cards and gate notes (no inline styles) */
.ai-code { margin: 0 0 22px; background: #0b1120; border: 1px solid var(--navy-border); border-radius: 12px; overflow: hidden; }
.ai-code-label {
  display: block; padding: 8px 16px; font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: 0.08em;
  color: var(--cyan); border-bottom: 1px solid var(--navy-border); background: rgba(0, 229, 255, 0.04);
}
.ai-code pre { margin: 0; padding: 16px 18px; overflow-x: auto; }
.ai-code code { font-family: 'Space Mono', monospace; font-size: 12.5px; line-height: 1.6; color: #cdd9f0; white-space: pre; }
.ai-table-wrap { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--navy-border); border-radius: 12px; }
.ai-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.ai-table th, .ai-table td { text-align: left; vertical-align: top; padding: 11px 14px; border-bottom: 1px solid var(--navy-border); }
.ai-table th {
  font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 400; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--cyan); background: var(--navy-mid);
}
.ai-table td { color: var(--white-dim); line-height: 1.55; }
.ai-table tr:last-child td { border-bottom: none; }
.ai-note, .ai-gate { color: var(--muted-light); font-size: 14px; line-height: 1.6; margin: 10px 0 0; }
.ai-gate strong { color: var(--white); }
.ai-badge {
  display: inline-block; font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: 0.08em;
  border-radius: 5px; padding: 3px 9px; border: 1px solid; text-transform: uppercase;
}
.ai-badge.ok { color: var(--success); border-color: var(--success); background: rgba(16, 185, 129, 0.08); }
.ai-badge.warn { color: #f59e0b; border-color: #f59e0b; background: rgba(245, 158, 11, 0.08); }
.ai-adr { background: var(--navy-card); border: 1px solid var(--navy-border); border-radius: 14px; padding: 22px 26px; margin-bottom: 16px; scroll-margin-top: 240px; }
.ai-adr > header { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.ai-adr-num { font-family: 'Space Mono', monospace; font-size: 12px; letter-spacing: 0.1em; color: var(--cyan); }
.ai-adr-date { font-family: 'Space Mono', monospace; font-size: 12px; color: var(--muted-light); }
.ai-adr h3 { flex-basis: 100%; font-family: 'Space Grotesk', sans-serif; font-size: 19px; font-weight: 600; margin: 0; }
.ai-adr-body { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 28px; }
.ai-adr-body > div:nth-child(-n+2) { grid-column: span 1; }
.ai-adr-body > div:nth-child(n+3) { grid-column: 1 / -1; }
.ai-adr-body dt { font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-light); margin-bottom: 6px; }
.ai-adr-body dd { color: var(--white-dim); font-size: 14.5px; line-height: 1.65; }
.ai-adr-body dd ul { padding-left: 18px; }
.ai-adr-body dd li { margin-bottom: 4px; }
@media (max-width: 900px) {
  .ai-adr-body { grid-template-columns: 1fr; }
  .ai-adr-body > div:nth-child(n) { grid-column: 1 / -1; }
  .ai-adr { padding: 18px 18px; }
}

.mmd.ai-diagram { width: auto; max-width: 100%; margin: 0 auto; }
.mmd.ai-diagram.wide { max-width: none; }

/* Mermaid diagrams: pre-rendered by scripts/render_mermaid.py. Mermaid's inline
   styles are stripped at build time, so these classes colour what it leaves behind. */
.mmd { font-family: Arial, Helvetica, sans-serif; }
.mmd text, .mmd .label, .mmd .nodeLabel, .mmd .text-inner-tspan, .mmd .text-outer-tspan {
  fill: var(--white-dim); font-family: Arial, Helvetica, sans-serif; font-size: 16px;
}
.mmd .background { fill: transparent; }
/* Mermaid centres node and edge labels with its own stylesheet, which the build strips; restore that rule. */
.mmd .label text, .mmd .edgeLabel text { text-anchor: middle; }
.mmd .basic.label-container, .mmd .label-container, .mmd .statediagram-state .basic,
.mmd .node-bkg, .mmd .actor-box {
  fill: var(--navy-card); stroke: var(--cobalt); stroke-width: 1.5;
}
.mmd .node path, .mmd .node rect, .mmd .node polygon, .mmd .node circle {
  fill: var(--navy-card); stroke: var(--cobalt); stroke-width: 1.5;
}
.mmd .node .label, .mmd .node text { fill: var(--white); }
.mmd .state-start, .mmd .state-end { fill: var(--cyan); stroke: var(--cyan); }
.mmd .outer-path { fill: var(--navy-mid); stroke: var(--navy-border); }
.mmd .edge-thickness-normal { stroke: var(--muted-light); stroke-width: 1.6; fill: none; }
.mmd .edge-pattern-dotted { stroke-dasharray: 5 5; }
.mmd .edge-pattern-solid { stroke-dasharray: 0; }
.mmd .arrowMarkerPath, .mmd .marker path { fill: var(--muted-light); stroke: var(--muted-light); }
.mmd .marker.cross path { stroke: var(--muted-light); }
.mmd .edgeLabel rect { fill: var(--navy-mid); opacity: 0.9; }
.mmd .edgeLabel .label, .mmd .edgeLabel text { fill: var(--white-dim); }
.mmd .transition { stroke: var(--muted-light); stroke-width: 1.6; fill: none; }
.mmd .actor-line { stroke: var(--navy-border); }
.mmd .messageLine0, .mmd .messageLine1 { stroke: var(--cyan); stroke-width: 1.6; }
.mmd .messageLine1 { stroke-dasharray: 5 4; stroke: var(--cobalt-light); }
.mmd .messageText, .mmd .actor { fill: var(--white); }
.mmd .actor { stroke: none; }
.mmd .node-line-0, .mmd .node-line--1, .mmd .node-line-1, .mmd .node-line-2,
.mmd .node-line-3, .mmd .node-line-4, .mmd .node-line-5 { stroke: var(--cobalt); stroke-width: 2; }
.mmd .lineWrapper line { stroke: var(--navy-border); }
.mmd .node-undefined .node-bkg { fill: var(--navy-card); }

/* Glossary: term hints and the usage popup (super-ai/ai-learning/glossary.js) */
.gl-term { cursor: help; text-decoration: underline dotted var(--cyan); text-underline-offset: 4px; }
.gl-term:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 4px; }
.gl-pop {
  position: absolute; z-index: 1000; width: 340px; max-width: calc(100vw - 24px); max-height: 50vh; overflow-y: auto;
  background: var(--navy-card); border: 1px solid var(--cobalt); border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.gl-pop[hidden] { display: none; }
.gl-pop-head {
  font-family: 'Space Mono', monospace; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--cyan); margin: 0 0 8px;
}
.gl-pop ul { list-style: none; margin: 0; padding: 0; }
.gl-pop li { padding: 7px 0; border-bottom: 1px solid var(--navy-border); }
.gl-pop li:last-child { border-bottom: none; }
.gl-pop a { color: var(--white); font-weight: 600; font-size: 14.5px; text-decoration: none; }
.gl-pop a:hover, .gl-pop a:focus-visible { color: var(--cyan); text-decoration: underline; }
.gl-pop-path { display: block; font-family: 'Space Mono', monospace; font-size: 11.5px; color: var(--muted-light); }
