/* MadAI Systems v31 — lightweight cursor constellation, command palette and shared page experience. */

.madai-cursor-constellation {
  position: fixed;
  z-index: 2147483000;
  top: 0;
  left: 0;
  width: 96px;
  height: 96px;
  opacity: 0;
  pointer-events: none;
  contain: layout paint style;
  color: var(--accent, #4f7100);
  transform: translate3d(-120px, -120px, 0);
  transition: opacity 180ms ease;
  will-change: transform;
}

.madai-cursor-constellation.is-visible { opacity: .72; }
.madai-cursor-constellation svg { width: 100%; height: 100%; overflow: visible; }
.madai-cursor-constellation .cursor-orbit { fill: none; stroke: currentColor; stroke-width: .75; opacity: .23; }
.madai-cursor-constellation .cursor-orbit-b { stroke-dasharray: 3 5; opacity: .34; }
.madai-cursor-constellation .cursor-signal { fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; opacity: .58; }
.madai-cursor-constellation .cursor-nodes { fill: currentColor; opacity: .74; }
.madai-cursor-constellation .cursor-core { fill: currentColor; opacity: .9; }
.madai-cursor-constellation.is-action { opacity: .94; }
.madai-cursor-constellation.is-action svg { transform: scale(1.08); }
.madai-cursor-constellation.is-pressed svg { transform: scale(.91); }
.madai-cursor-constellation svg { transition: transform 130ms cubic-bezier(.16,1,.3,1); }

html[data-theme="dark"] .madai-cursor-constellation { color: #79e7ff; }

.madai-command-trigger {
  min-height: 38px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted, #596254);
  border: 1px solid var(--line, #cbd3c3);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface, #fff) 88%, transparent);
  font: 700 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .06em;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.madai-command-trigger:hover,
.madai-command-trigger:focus-visible { color: var(--accent, #4f7100); border-color: currentColor; transform: translateY(-1px); }
.madai-command-trigger svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }
.madai-command-trigger kbd { padding: 3px 5px; border: 1px solid var(--line, #cbd3c3); border-radius: 6px; color: inherit; background: transparent; font: inherit; }
.madai-command-trigger.is-floating { position: fixed; z-index: 1400; right: 18px; bottom: 18px; box-shadow: 0 14px 38px rgba(18,23,15,.13); }

.madai-command-overlay {
  position: fixed;
  z-index: 2147483200;
  inset: 0;
  padding: min(8vh, 74px) 18px 24px;
  display: grid;
  place-items: start center;
  opacity: 0;
  background: rgba(9, 14, 18, .52);
  transition: opacity 170ms ease;
}
.madai-command-overlay[hidden] { display: none; }
.madai-command-overlay.is-open { opacity: 1; }
html.madai-command-open { overflow: hidden; }

.madai-command-panel {
  width: min(940px, 100%);
  max-height: calc(100vh - min(10vh, 92px));
  overflow: auto;
  color: var(--text, #12170f);
  border: 1px solid var(--line, #cbd3c3);
  border-radius: 28px;
  background: color-mix(in srgb, var(--surface, #fff) 96%, var(--bg, #f5f7f1));
  box-shadow: 0 34px 110px rgba(0,0,0,.28);
  transform: translateY(-12px) scale(.985);
  transition: transform 190ms cubic-bezier(.16,1,.3,1);
  contain: layout paint;
}
.madai-command-overlay.is-open .madai-command-panel { transform: translateY(0) scale(1); }
.madai-command-head { padding: 23px 25px 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line, #cbd3c3); }
.madai-command-head small,
.madai-compass-copy small,
.madai-command-group > small,
.madai-compass-result > small { color: var(--accent, #4f7100); font: 750 8px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .15em; }
.madai-command-head h2 { margin: 9px 0 0; font-size: clamp(21px, 3vw, 32px); line-height: 1; letter-spacing: -.04em; }
.madai-command-close { width: 38px; height: 38px; display: grid; place-items: center; color: var(--muted, #596254); border: 1px solid var(--line, #cbd3c3); border-radius: 50%; background: transparent; font-size: 23px; cursor: pointer; }
.madai-command-close:hover { color: var(--accent, #4f7100); border-color: currentColor; }

.madai-command-search { min-height: 58px; margin: 18px 22px 0; padding: 0 14px; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; border: 1px solid var(--line, #cbd3c3); border-radius: 17px; background: color-mix(in srgb, var(--surface, #fff) 90%, transparent); }
.madai-command-search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted, #596254); stroke-width: 1.4; stroke-linecap: round; }
.madai-command-search input { width: 100%; min-width: 0; color: var(--text, #12170f); border: 0; outline: 0; background: transparent; font: 600 15px/1.2 Inter, ui-sans-serif, system-ui, sans-serif; }
.madai-command-search input::placeholder { color: color-mix(in srgb, var(--muted, #596254) 72%, transparent); }
.madai-command-search kbd { color: var(--muted, #596254); font: 700 8px ui-monospace, monospace; }

.madai-command-results { padding: 18px 22px 3px; display: grid; grid-template-columns: 1.35fr .65fr; gap: 18px; }
.madai-command-group { min-width: 0; }
.madai-command-group > small { display: block; margin: 0 0 9px 4px; }
.madai-command-group button { width: 100%; min-height: 55px; padding: 10px 13px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--text, #12170f); border: 0; border-radius: 14px; background: transparent; text-align: left; cursor: pointer; }
.madai-command-group button:hover,
.madai-command-group button:focus-visible { outline: none; background: color-mix(in srgb, var(--accent, #4f7100) 8%, transparent); }
.madai-command-group button span { min-width: 0; display: grid; gap: 4px; }
.madai-command-group strong { font-size: 13px; }
.madai-command-group em { overflow: hidden; color: var(--muted, #596254); font-size: 10px; font-style: normal; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.madai-command-group i { color: var(--accent, #4f7100); font-style: normal; }
.madai-command-empty { grid-column: 1/-1; margin: 0; padding: 26px; color: var(--muted, #596254); text-align: center; }

.madai-compass { margin: 18px 22px 22px; padding: 22px; display: grid; grid-template-columns: .82fr 1.18fr; gap: 25px; border: 1px solid var(--line, #cbd3c3); border-radius: 22px; background: color-mix(in srgb, var(--accent, #4f7100) 5%, var(--surface, #fff)); }
.madai-compass-copy h3 { margin: 11px 0 0; font-size: 22px; line-height: 1.08; letter-spacing: -.035em; }
.madai-compass-copy p { margin: 12px 0 0; color: var(--muted, #596254); font-size: 11px; line-height: 1.55; }
.madai-compass-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 9px; align-items: end; }
.madai-compass-form label { min-width: 0; display: grid; gap: 6px; }
.madai-compass-form label span { color: var(--muted, #596254); font: 700 8px ui-monospace, monospace; letter-spacing: .06em; }
.madai-compass-form select { width: 100%; min-height: 42px; padding: 0 28px 0 10px; color: var(--text, #12170f); border: 1px solid var(--line, #cbd3c3); border-radius: 11px; background: var(--surface, #fff); font-size: 10px; }
.madai-compass-form button { min-height: 42px; padding: 0 13px; color: #fff; border: 1px solid var(--accent, #4f7100); border-radius: 11px; background: var(--accent, #4f7100); font-size: 10px; font-weight: 750; cursor: pointer; white-space: nowrap; }
.madai-compass-result { grid-column: 1/-1; padding-top: 20px; border-top: 1px solid var(--line, #cbd3c3); }
.madai-compass-result h4 { margin: 9px 0 0; font-size: 24px; letter-spacing: -.035em; }
.madai-compass-result > strong { display: block; margin-top: 7px; color: var(--accent, #4f7100); font-size: 13px; }
.madai-compass-result p { max-width: 720px; margin: 10px 0 0; color: var(--muted, #596254); font-size: 12px; line-height: 1.6; }
.madai-compass-result div { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.madai-compass-result a { min-height: 38px; padding: 0 13px; display: inline-flex; align-items: center; border: 1px solid var(--line, #cbd3c3); border-radius: 999px; font-size: 10px; font-weight: 750; }
.madai-compass-result a:first-child { color: #fff; border-color: var(--accent, #4f7100); background: var(--accent, #4f7100); }

.package-price { display: block; margin: 17px 0 0; color: var(--accent); font-size: 17px; font-weight: 760; letter-spacing: -.025em; }
.package-footnote .madai-pricing-link { margin-left: auto; color: var(--accent); font-size: 11px; font-weight: 750; white-space: nowrap; }
.certification-standard-grid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
.certification-standard-card { min-height: 152px; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 92%, transparent); }
.certification-standard-card small { color: var(--accent); font: 700 8px ui-monospace, monospace; letter-spacing: .11em; }
.certification-standard-card strong { display: block; margin-top: 30px; font-size: 14px; }
.certification-standard-card span { display: block; margin-top: 7px; color: var(--muted); font-size: 9px; line-height: 1.45; }

html[data-theme="dark"] body.page,
html[data-theme="dark"] body { --bg:#090b0a;--surface:#111511;--surface-soft:#151b14;--text:#f4f7ef;--muted:#a9b3a3;--line:rgba(209,224,200,.16);--accent:#a6cf45;--accent-2:#67d4ff;--shadow:0 28px 90px rgba(0,0,0,.32); }
html[data-theme="dark"] body { background: radial-gradient(circle at 82% 8%,rgba(37,99,235,.12),transparent 32rem),radial-gradient(circle at 10% 62%,rgba(118,168,24,.08),transparent 28rem),var(--bg); }
html[data-theme="dark"] .architecture,
html[data-theme="dark"] .card-grid article,
html[data-theme="dark"] .related a,
html[data-theme="dark"] .evidence-grid article,
html[data-theme="dark"] .answer-summary { background: rgba(17,21,17,.78); }
html[data-theme="dark"] .architecture-rows div { background: rgba(17,21,17,.82); }
html[data-theme="dark"] .madai-command-panel { --surface:#111511; --bg:#090b0a; --text:#f4f7ef; --muted:#a9b3a3; --line:rgba(209,224,200,.16); --accent:#a6cf45; }
html[data-theme="dark"] .madai-command-search,
html[data-theme="dark"] .madai-compass-form select { background: #0d110d; }
html.madai-theme-transition-v31 *,
html.madai-theme-transition-v31 *::before,
html.madai-theme-transition-v31 *::after { transition-duration: 0ms !important; animation-play-state: paused !important; }

@media (max-width: 920px) {
  .madai-command-results { grid-template-columns: 1fr; }
  .madai-compass { grid-template-columns: 1fr; }
  .madai-compass-form { grid-template-columns: 1fr 1fr; }
  .madai-compass-form button { grid-column: 1/-1; }
  .certification-standard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 680px) {
  .madai-cursor-constellation { display: none; }
  .madai-command-trigger span,
  .madai-command-trigger kbd { display: none; }
  .madai-command-trigger { width: 38px; padding: 0; }
  .madai-command-trigger.is-floating { right: 12px; bottom: 12px; }
  .madai-command-overlay { padding: 8px; place-items: stretch; }
  .madai-command-panel { max-height: calc(100vh - 16px); border-radius: 22px; }
  .madai-command-head { padding: 19px; }
  .madai-command-search { margin: 14px 15px 0; }
  .madai-command-results { padding: 14px 15px 0; }
  .madai-compass { margin: 14px 15px 15px; padding: 18px; }
  .madai-compass-form { grid-template-columns: 1fr; }
  .madai-compass-form button { grid-column: auto; }
  .certification-standard-grid { grid-template-columns: 1fr !important; }
  .package-footnote .madai-pricing-link { width: 100%; margin: 12px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  .madai-cursor-constellation { display: none; }
  .madai-command-overlay,
  .madai-command-panel { transition: none; }
}


/* v32 stronger cursor constellation */
.madai-cursor-constellation{filter:drop-shadow(0 0 18px color-mix(in srgb,currentColor 32%, transparent))}.madai-cursor-constellation.is-visible{opacity:.84}.madai-cursor-constellation .cursor-orbit{stroke-width:.85;opacity:.34}.madai-cursor-constellation .cursor-orbit-b{opacity:.46}.madai-cursor-constellation .cursor-signal{stroke-width:1.65;opacity:.7}.madai-cursor-constellation .cursor-core{opacity:1}.madai-cursor-constellation.is-action{opacity:1}


/* v35 — path-based language separation and accessibility */
.madai-skip-link{position:fixed;left:18px;top:14px;z-index:2147483646;transform:translateY(-180%);padding:10px 14px;background:var(--surface,#fff);color:var(--text,#12170f);border:1px solid var(--accent,#4f7100);font-weight:700;text-decoration:none}
.madai-skip-link:focus{transform:translateY(0)}
.madai-anchor-alias{display:block;position:relative;top:-110px;visibility:hidden}
