/* Ventega AI – global UI corrections and accessibility layer.
   Loaded last on every page so themes, links, navigation and legal pages
   behave consistently across the mixed static/inline codebase. */

:root,
html[data-theme="dark"],
html[data-theme="dark"] body {
  color-scheme: dark;
  --bg:#0B0712;
  --bg-elev:#11091b;
  --surface:#150E22;
  --surface-2:#1D1430;
  --border:#3A2A58;
  --border-soft:#2A1F40;
  --violet:#8B5CF6;
  --violet-bright:#B29AFF;
  --violet-deep:#6D3FE0;
  --magenta:#D946EF;
  --text:#F4F0FC;
  --muted:#BEB4D5;
  --faint:#9488AF;
  --good:#4F8F63;
  --warn:#FBBF24;
  --bad:#F87171;
}

html[data-theme="light"],
html[data-theme="light"] body {
  color-scheme: light;
  --bg:#F7F5FB;
  --bg-elev:#FFFFFF;
  --surface:#FFFFFF;
  --surface-2:#F0ECF8;
  --border:#CEC3E3;
  --border-soft:#E3DDEF;
  --violet:#6D3FE0;
  --violet-bright:#7448DD;
  --violet-deep:#5529C7;
  --magenta:#A81AC6;
  --text:#24212B;
  --muted:#53505E;
  --faint:#625D6C;
  --good:#346A42;
  --warn:#855000;
  --bad:#B72E3A;
}

html { background:var(--bg); }
body {
  background:var(--bg) !important;
  color:var(--text) !important;
  min-height:100vh;
}
body::before { opacity:1; }
html[data-theme="light"] body::before {
  background:
    radial-gradient(900px 520px at 88% -10%, rgba(109,63,224,.12), transparent 62%),
    radial-gradient(760px 520px at -10% 30%, rgba(217,70,239,.07), transparent 62%) !important;
}

/* Never fall back to browser blue/purple link colours. */
a,
a:visited { color:var(--text); }
main p a,
main li a,
main td a,
main .legal-section a,
footer a,
footer a:visited {
  color:var(--text) !important;
  text-decoration-color:rgba(178,154,255,.72);
  text-underline-offset:3px;
}
main p a:hover,
main li a:hover,
main td a:hover,
main .legal-section a:hover,
footer a:hover,
main p a:focus-visible,
main li a:focus-visible,
main td a:focus-visible,
footer a:focus-visible { color:var(--violet-bright) !important; }
html[data-theme="light"] main p a:hover,
html[data-theme="light"] main li a:hover,
html[data-theme="light"] main td a:hover,
html[data-theme="light"] footer a:hover { color:var(--violet) !important; }

/* Preserve component-specific link/button design. */
a.btn,
a.btn:visited { color:#fff !important; }
a.btn-ghost,
a.btn-ghost:visited { color:var(--text) !important; }
a.card,
a.card:visited,
a.svc,
a.svc:visited,
a.next-card,
a.next-card:visited,
a.path-chip,
a.path-chip:visited,
a.wordmark,
a.wordmark:visited { color:inherit; }

/* Navigation */
nav {
  background:rgba(11,7,18,.88) !important;
  border-bottom:1px solid var(--border-soft) !important;
  -webkit-backdrop-filter:blur(16px);
  backdrop-filter:blur(16px);
}
html[data-theme="light"] nav { background:rgba(255,255,255,.90) !important; }
.nav-inner { position:relative; }
.nav-links { align-items:center; }
.nav-links > a,
.nav-links > a:visited { color:var(--muted) !important; text-decoration:none; }
.nav-links > a:hover,
.nav-links > a:focus-visible,
.nav-links > a[aria-current="page"] { color:var(--text) !important; }
.wordmark { color:var(--text) !important; }
.wordmark-hero {
  text-shadow:
    0 0 10px rgba(248,245,255,.22),
    0 0 34px rgba(139,92,246,.62),
    0 0 78px rgba(139,92,246,.34) !important;
}
html[data-theme="light"] .wordmark-hero {
  text-shadow:0 0 24px rgba(198,143,31,.24),0 0 62px rgba(236,188,74,.18) !important;
}

.nav-toggle {
  display:none;
  align-items:center;
  justify-content:center;
  width:42px;
  height:42px;
  border:1px solid var(--border);
  border-radius:10px;
  background:rgba(139,92,246,.08);
  color:var(--text);
  cursor:pointer;
}
.nav-toggle span,
.nav-toggle::before,
.nav-toggle::after {
  content:"";
  width:18px;
  height:2px;
  border-radius:2px;
  background:currentColor;
  display:block;
  transition:transform .2s ease,opacity .2s ease;
}
.nav-toggle { gap:4px; flex-direction:column; }
.nav-toggle[aria-expanded="true"] span { opacity:0; }
.nav-toggle[aria-expanded="true"]::before { transform:translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"]::after { transform:translateY(-6px) rotate(-45deg); }

.vt-display-btn {
  display:inline-flex;
  align-items:center;
  gap:7px;
  min-height:36px;
  padding:7px 12px;
  border:1px solid rgba(178,154,255,.55) !important;
  border-radius:9px;
  background:rgba(139,92,246,.13) !important;
  color:var(--text) !important;
  font:inherit;
  font-size:13px;
  cursor:pointer;
}
.vt-display-btn::before { content:"◐"; font-size:14px; color:var(--violet-bright); }
.vt-display-btn:hover,
.vt-display-btn:focus-visible { background:rgba(139,92,246,.22) !important; border-color:var(--violet-bright) !important; }

.lang-switch {
  display:inline-flex;
  align-items:center;
  min-height:36px;
  padding:6px 10px;
  border:1px solid var(--border);
  border-radius:9px;
  color:var(--text) !important;
  font-family:'IBM Plex Mono',monospace;
  font-size:11.5px !important;
  letter-spacing:.06em;
  text-decoration:none !important;
}
.lang-switch:hover { border-color:var(--violet); }

/* Display dialog */
.vt-display-dialog {
  position:fixed;
  inset:0;
  z-index:2147483000;
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:rgba(5,2,9,.72);
  -webkit-backdrop-filter:blur(7px);
  backdrop-filter:blur(7px);
}
.vt-display-dialog.open { display:flex; }
.vt-display-panel {
  width:min(94vw,470px);
  max-height:90vh;
  overflow:auto;
  background:linear-gradient(155deg,var(--surface-2),var(--surface));
  color:var(--text);
  border:1px solid var(--border);
  border-radius:18px;
  padding:24px;
  box-shadow:0 26px 80px rgba(0,0,0,.42),0 0 45px rgba(139,92,246,.14);
}
html[data-theme="light"] .vt-display-panel { box-shadow:0 24px 70px rgba(45,30,85,.20); }
.vt-display-panel h2 { margin:0 0 5px; font-family:'Sora',sans-serif; font-size:21px; }
.vt-display-intro { margin:0 0 19px; color:var(--muted); font-size:13px; }
.vt-display-group { margin:0 0 17px; }
.vt-display-group fieldset { border:0; margin:0; padding:0; }
.vt-display-group legend {
  display:block;
  width:100%;
  margin:0 0 8px;
  color:var(--faint);
  font-family:'IBM Plex Mono',monospace;
  font-size:11px;
  letter-spacing:.11em;
  text-transform:uppercase;
}
.vt-opts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.vt-opts label {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  min-height:42px;
  padding:7px 9px;
  border:1px solid var(--border-soft);
  border-radius:9px;
  color:var(--muted);
  background:rgba(255,255,255,.015);
  cursor:pointer;
  text-align:center;
  font-size:13px;
}
.vt-opts label:has(input:checked) {
  border-color:var(--violet);
  background:rgba(139,92,246,.16);
  color:var(--text);
  box-shadow:inset 0 0 0 1px rgba(178,154,255,.18);
}
.vt-opts input { accent-color:var(--violet); }
.vt-display-note { margin:4px 0 14px; color:var(--faint); font-size:12px; }
.vt-display-close {
  width:100%;
  min-height:44px;
  border:1px solid var(--violet);
  border-radius:10px;
  background:linear-gradient(92deg,var(--violet-deep),var(--violet));
  color:#fff;
  font:600 14px 'Sora',sans-serif;
  cursor:pointer;
}

/* Accessibility options */
html.contrast-high[data-theme="dark"] {
  --text:#fff; --muted:#F0ECF8; --faint:#DDD5ED; --border:#D5C9EA; --border-soft:#8C7DA7;
}
html.contrast-high[data-theme="light"] {
  --text:#0D0B12; --muted:#25212D; --faint:#3D3748; --border:#3A304A; --border-soft:#746B82;
}
html.text-large { font-size:115%; }
html.links-underline main a,
html.links-underline footer a,
html.links-underline .nav-links a { text-decoration:underline !important; text-underline-offset:4px; }
html.motion-reduce *,
html.motion-reduce *::before,
html.motion-reduce *::after {
  animation-duration:.001ms !important;
  animation-iteration-count:1 !important;
  transition-duration:.001ms !important;
  scroll-behavior:auto !important;
}

/* Legal pages */
body.legal-page {
  background:
    radial-gradient(900px 520px at 78% -8%,rgba(139,92,246,.17),transparent 64%),
    radial-gradient(720px 500px at -8% 40%,rgba(217,70,239,.09),transparent 62%),
    var(--bg) !important;
}
.legal-shell { max-width:920px; margin:0 auto; }
.legal-page .page-hero {
  position:relative;
  max-width:900px;
  margin:0 auto 28px;
  padding:76px 26px 30px;
  text-align:center;
}
.legal-page .page-hero::before {
  content:"";
  position:absolute;
  z-index:-1;
  inset:25px 0 -12px;
  border:1px solid var(--border-soft);
  border-radius:24px;
  background:linear-gradient(145deg,rgba(139,92,246,.10),rgba(217,70,239,.025),transparent 72%);
  box-shadow:0 18px 65px rgba(0,0,0,.18);
}
.legal-page .page-hero h1 { font-size:clamp(34px,5vw,54px); }
.legal-draft {
  display:flex;
  gap:14px;
  align-items:flex-start;
  margin:0 0 26px;
  padding:18px 20px;
  border:1px solid rgba(251,191,36,.62);
  border-radius:15px;
  background:linear-gradient(120deg,rgba(251,191,36,.13),rgba(251,191,36,.055));
  color:var(--text);
  box-shadow:0 12px 35px rgba(0,0,0,.12);
}
.legal-draft strong { display:block; margin-bottom:4px; }
.legal-draft .ld-icon { flex:none; font-size:21px; }
.legal-section,
.legal-card {
  position:relative;
  margin:0 0 18px;
  padding:24px 26px;
  border:1px solid var(--border-soft);
  border-radius:16px;
  background:linear-gradient(150deg,rgba(29,20,48,.84),rgba(21,14,34,.96));
  box-shadow:0 14px 42px rgba(0,0,0,.13);
}
html[data-theme="light"] .legal-section,
html[data-theme="light"] .legal-card {
  background:linear-gradient(150deg,#fff,#F8F5FC);
  box-shadow:0 14px 40px rgba(50,32,90,.10);
}
.legal-section h2,
.legal-card + h2,
.legal h2 {
  margin:0 0 13px !important;
  padding:0 0 0 14px;
  border-left:3px solid var(--violet);
  color:var(--text);
  font:700 clamp(19px,2.3vw,23px) 'Sora',sans-serif;
}
.legal-section p:last-child,
.legal-section ul:last-child { margin-bottom:0; }
.legal-section p,
.legal-section li,
.legal-card th,
.legal-card td { color:var(--muted); line-height:1.75; }
.legal-card table { width:100%; border-collapse:collapse; }
.legal-card th { width:175px; padding:9px 20px 9px 0; text-align:left; vertical-align:top; color:var(--faint); font-weight:500; }
.legal-card td { padding:9px 0; color:var(--text); overflow-wrap:anywhere; }
.legal-page footer { margin-top:44px; }

/* Light-theme component corrections for hard-coded dark gradients. */
html[data-theme="light"] .cta,
html[data-theme="light"] .final-cta,
html[data-theme="light"] .final,
html[data-theme="light"] .solution,
html[data-theme="light"] .sec-panel {
  color:var(--text);
  background:linear-gradient(145deg,#FFFFFF,#F0EAF9) !important;
  border-color:var(--border) !important;
}
html[data-theme="light"] .kpi.lead,
html[data-theme="light"] .path-step { background:var(--surface-2) !important; }
html[data-theme="light"] .text-input { background:#fff !important; color:var(--text) !important; }
html[data-theme="light"] .slogan-hero { text-shadow:none; }

/* Light-mode readability for the three confirmed legacy graphics. */
html[data-theme="light"] .amp-g p,
html[data-theme="light"] .amp-g .bsp { color:#075F46 !important; }
html[data-theme="light"] .amp-y p,
html[data-theme="light"] .amp-y .bsp { color:#775000 !important; }
html[data-theme="light"] .amp-r p,
html[data-theme="light"] .amp-r .bsp { color:#8F2832 !important; }
html[data-theme="light"] .cd.pick,
html[data-theme="light"] .cd.pick * { color:#fff !important; }
.pill.pb {
  color:#7FB7E8 !important;
  background:rgba(96,165,250,.12) !important;
  border-color:rgba(96,165,250,.35) !important;
}
html[data-theme="light"] .pill.pb {
  color:#174F83 !important;
  background:rgba(37,99,235,.10) !important;
  border-color:rgba(37,99,235,.32) !important;
}

/* Footer */
footer { color:var(--faint) !important; }
.legal-links { display:inline-flex; flex-wrap:wrap; gap:7px 11px; margin-top:7px; }
.legal-links a { white-space:nowrap; }

/* Mobile navigation and dialog */
@media (max-width:860px) {
  .nav-toggle { display:flex; margin-left:auto; }
  .nav-inner { flex-wrap:wrap; }
  .nav-links {
    display:none !important;
    width:100%;
    flex-direction:column;
    align-items:stretch;
    gap:4px !important;
    padding:12px 0 8px;
  }
  .nav-links.is-open { display:flex !important; }
  .nav-links > a,
  .nav-links > button { width:100%; justify-content:flex-start; min-height:43px; padding:10px 12px !important; border-radius:9px; }
  .nav-links > a:hover { background:rgba(139,92,246,.08); }
  .vt-opts { grid-template-columns:1fr; }
}

@media (max-width:600px) {
  .legal-page .page-hero { padding:60px 18px 24px; }
  .legal-page .page-hero::before { inset:18px 0 -8px; border-radius:18px; }
  .legal-section,.legal-card,.legal-draft { padding:19px 18px; border-radius:13px; }
  .legal-card table,.legal-card tbody,.legal-card tr,.legal-card th,.legal-card td { display:block; width:100%; }
  .legal-card tr { padding:7px 0; border-bottom:1px solid var(--border-soft); }
  .legal-card tr:last-child { border-bottom:0; }
  .legal-card th { padding:0 0 3px; }
  .legal-card td { padding:0; }
}

@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior:auto !important; }
}
