/* WAIG interactive whitepaper shell — EXTERNAL file required (CSP blocks inline <style>). */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
}

:root {
  --bg: #09090b;
  --panel: #0a0a0a;
  --text: #fafafa;
  --muted: #d4d4d8;
  --accent: #34d399;
  --shell-top: 56px;
  --topnav-h: 56px;
  /* WCAG-friendly reading colors on near-black */
  --read-body: #ececf1;
  --read-muted: #d0d0d8;
  --read-faint: #b8b8c2;
  --wp-text: #fafafa;
  --fs-body: 16px;
  --fs-small: 13.5px;
  --fs-label: 12px;
  --lh-body: 1.75;
}

html.light {
  --bg: #ffffff;
  --panel: #f8fafc;
  --text: #0f172a;
  --muted: #334155;
  --accent: #047857;
  --read-body: #1e293b;
  --read-muted: #334155;
  --read-faint: #475569;
  --wp-text: #0f172a;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 3px;
}
html.light ::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

::selection {
  background: rgb(6, 78, 59);
  color: #fff;
}
html.light ::selection {
  background: rgba(5, 150, 105, 0.22);
  color: var(--text);
}

/* ===== SIDEBAR ===== */
#sidebar {
  position: fixed;
  left: 0;
  top: var(--shell-top);
  bottom: 0;
  width: 240px;
  z-index: 40;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: rgba(9, 9, 11, 0.98);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  padding: 24px 0 40px;
  pointer-events: auto;
}
#sidebar::-webkit-scrollbar {
  width: 3px;
}
#sidebar::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 2px;
}

.sb-section {
  padding: 0 20px;
  margin-bottom: 20px;
}
.sb-label {
  font-size: var(--fs-label);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--read-faint);
  font-weight: 600;
  margin-bottom: 10px;
}
.sb-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 20px;
  font-size: 13.5px;
  color: var(--read-body);
  border: none;
  background: none;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  text-align: left;
}
.sb-btn:hover {
  color: var(--wp-text);
  background: rgba(255, 255, 255, 0.04);
  border-left-color: rgba(52, 211, 153, 0.5);
}
.sb-btn.active {
  color: #34d399;
  background: rgba(16, 185, 129, 0.08);
  border-left-color: #34d399;
  font-weight: 600;
}
.sb-btn .n {
  color: var(--read-muted);
  font-size: 12px;
  font-weight: 700;
  min-width: 22px;
}
.sb-btn.active .n {
  color: #6ee7b7;
}
.sb-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.04);
  margin: 0 20px 20px;
}

/* ===== TOP NAV ===== */
#topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topnav-h);
  z-index: 50;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(9, 9, 11, 0.9);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 16px;
}
.tn-btn {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--read-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}
.tn-btn:hover {
  color: var(--wp-text);
  background: rgba(255, 255, 255, 0.06);
}
.tn-btn.active {
  color: var(--wp-text);
  background: rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

#tnwrap {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  min-width: 0;
}

/* ===== MAIN ===== */
#main {
  margin-left: 240px;
  padding-top: var(--shell-top);
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}

.pg {
  display: none;
}
.pg.on {
  display: block;
  animation: pgIn 0.3s ease;
}
@keyframes pgIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ===== COMPONENTS ===== */
.glass {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.25s;
}
.glass:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}
.gtxt {
  background: none !important;
  -webkit-background-clip: unset !important;
  -webkit-text-fill-color: var(--wp-text, #fff) !important;
  color: var(--wp-text, #fff) !important;
}
.hgrad {
  background: radial-gradient(ellipse at top, rgba(6, 78, 59, 0.22), #09090b 70%, #09090b);
}
html.light .hgrad {
  background: radial-gradient(ellipse at top, rgba(5, 150, 105, 0.12), #ffffff 70%, #ffffff);
}
.gridbg {
  background-image: linear-gradient(to right, #80808012 1px, transparent 1px),
    linear-gradient(to bottom, #80808012 1px, transparent 1px);
  background-size: 60px 60px;
}
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.5;
  }
}
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}
.afloat {
  animation: float 6s ease-in-out infinite;
}
.pglow {
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.3));
}
@keyframes su {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.su {
  animation: su 0.6s ease forwards;
}

/* Bar charts (UAAF + interactive whitepapers) — requires --bar-h on each bar */
.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-height: 0;
  height: 100%;
}
.chart-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.chart-row--sm {
  gap: 10px;
}
.banim {
  width: 100%;
  height: var(--bar-h, 50%);
  min-height: 10px;
  flex-shrink: 0;
  transform-origin: bottom center;
  animation: barIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes barIn {
  from {
    transform: scaleY(0.15);
    opacity: 0.35;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}
.banim-row {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 90px;
  margin-bottom: 4px;
}
.banim-row .banim {
  flex: 1 1 auto;
  width: auto;
  height: var(--bar-h, 45%);
  min-height: 6px;
  align-self: flex-end;
}

/* Radar / hub infographic */
.radar-hub polygon.radar-fill {
  fill: rgba(16, 185, 129, 0.14);
  stroke: rgba(16, 185, 129, 0.45);
  stroke-width: 1.5;
}

.chip {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-label);
  color: var(--read-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px 12px;
  border-radius: 99px;
  white-space: nowrap;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.prose-s h3 {
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--wp-text);
  margin: 24px 0 10px;
}
.prose-s p,
.prose-s li {
  font-size: var(--fs-body);
  color: var(--read-body);
  line-height: var(--lh-body);
}
.prose-s ul {
  margin: 8px 0 14px;
  padding-left: 18px;
}
.prose-s li {
  margin: 6px 0;
}
.prose-s strong {
  color: var(--wp-text);
  font-weight: 650;
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-small);
}
.tbl th,
.tbl td {
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
.tbl th {
  color: var(--read-muted);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 650;
}
.tbl td {
  color: var(--read-body);
}
.nav-row {
  display: flex;
  justify-content: space-between;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  margin-top: 28px;
  gap: 12px;
  flex-wrap: wrap;
}
.btn-prev {
  padding: 9px 16px;
  background: none;
  color: var(--read-muted);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  font-size: var(--fs-small);
  cursor: pointer;
}
.btn-next {
  padding: 9px 16px;
  background: #fff;
  color: #09090b;
  border: none;
  border-radius: 8px;
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
}

/* ===== MOBILE ===== */
#moboverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.6);
}
#moboverlay.open {
  display: flex;
}
#mobpanel {
  width: 260px;
  background: #09090b;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  height: 100%;
  overflow-y: auto;
  padding: 20px 0;
}
@media (min-width: 1024px) {
  #mobbtn,
  #moboverlay {
    display: none !important;
  }
}
@media (max-width: 1023px) {
  #sidebar {
    display: none !important;
  }
  #main {
    margin-left: 0 !important;
  }
}

/* ===== PROPRIETARY NOTICE ===== */
#proprietary-notice {
  position: fixed;
  top: var(--topnav-h);
  left: 0;
  right: 0;
  z-index: 45;
  background: #1c1917;
  border-bottom: 1px solid rgba(234, 179, 8, 0.45);
  padding: 10px 20px;
  font-size: 12px;
  line-height: 1.55;
  color: #f5f5f4;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
#proprietary-notice strong {
  color: #fde68a;
}
#proprietary-notice a {
  color: #34d399;
  text-decoration: underline;
  font-weight: 500;
}

.read-block {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 28px;
}
.read-block h3 {
  font-size: 14px;
  font-weight: 600;
  color: #34d399;
  margin: 0 0 10px;
  letter-spacing: 0.02em;
}
.read-block p {
  font-size: var(--fs-body) !important;
  line-height: var(--lh-body) !important;
  margin: 0 0 10px;
  color: var(--read-body) !important;
}
.read-block p:last-child {
  margin-bottom: 0;
}
.read-block ul {
  margin: 8px 0 0;
  padding: 0 0 0 18px;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--read-body);
}
.read-block li {
  margin-bottom: 6px;
  color: var(--read-body);
}
.read-block strong {
  color: var(--wp-text);
}
#main .pg h1 {
  font-size: clamp(1.75rem, 3.6vw, 2.25rem) !important;
  font-weight: 650 !important;
  letter-spacing: -0.02em !important;
  color: var(--wp-text) !important;
}
.section-intro {
  font-size: var(--fs-body) !important;
  line-height: var(--lh-body) !important;
  color: var(--read-body) !important;
  max-width: 680px;
  margin-top: 10px;
}
.license-block {
  background: rgba(234, 179, 8, 0.06);
  border: 1px solid rgba(234, 179, 8, 0.25);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}
.license-block h3 {
  font-size: 1rem;
  font-weight: 650;
  color: #fde68a;
  margin: 0 0 10px;
}
.license-block p {
  font-size: var(--fs-body) !important;
  line-height: var(--lh-body) !important;
  color: var(--read-body) !important;
  margin: 0 0 8px;
}

/*
 * Readability pass — HTML still uses dark-theme zincs (#52525b / #71717a)
 * that fail contrast on black. Force readable sizes + colors in both themes.
 */
#main .pg p,
#main .pg li,
#main .prose-s p,
#main .prose-s li {
  font-size: var(--fs-body) !important;
  line-height: var(--lh-body) !important;
  color: var(--read-body) !important;
}
#main .pg p[style*="color:#71717a"],
#main .pg p[style*="color:#52525b"],
#main .pg p[style*="color:#a1a1aa"],
#main .pg li[style*="color:#71717a"],
#main .pg li[style*="color:#52525b"],
#main .pg li[style*="color:#a1a1aa"],
#main .pg ul[style*="color:#71717a"],
#main .pg ul[style*="color:#52525b"],
#main .pg ul[style*="color:#a1a1aa"],
#main .pg span[style*="color:#71717a"],
#main .pg span[style*="color:#52525b"],
#main .pg span[style*="color:#3f3f46"],
#main .pg div[style*="color:#71717a"],
#main .pg div[style*="color:#52525b"],
#main .pg div[style*="color:#a1a1aa"] {
  color: var(--read-body) !important;
}
#main .pg span[style*="color:#fff"],
#main .pg strong[style*="color:#fff"],
#main .pg span[style*="color:#e4e4e7"],
#main .pg strong[style*="color:#e4e4e7"] {
  color: var(--wp-text) !important;
}
/* Size bumps only — color handled by zinc overrides above so accents stay intact */
#main .pg [style*="font-size:8px"],
#main .pg [style*="font-size:9px"],
#main .pg [style*="font-size:10px"] {
  font-size: var(--fs-label) !important;
}
#main .pg [style*="font-size:11px"],
#main .pg [style*="font-size:12px"] {
  font-size: var(--fs-small) !important;
}
#main .pg [style*="font-size:13px"] {
  font-size: var(--fs-body) !important;
  line-height: var(--lh-body) !important;
}
#sidebar [style*="color:#3f3f46"],
#sidebar [style*="color:#52525b"],
#sidebar [style*="color:#71717a"],
#sidebar [style*="color:#a1a1aa"] {
  color: var(--read-body) !important;
}
#sidebar [style*="font-size:9px"],
#sidebar [style*="font-size:10px"] {
  font-size: var(--fs-label) !important;
}
#sidebar [style*="font-size:12px"] {
  font-size: var(--fs-small) !important;
}
.sb-label {
  color: var(--read-muted) !important;
}

/* Utility fallbacks (CSP blocks Tailwind Play style injection) */
.hidden {
  display: none !important;
}
@media (min-width: 640px) {
  .sm\:inline {
    display: inline !important;
  }
  .sm\:block {
    display: block !important;
  }
}
@media (min-width: 768px) {
  .md\:inline {
    display: inline !important;
  }
}
.stat-value {
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  color: var(--wp-text, #fff);
}
.stat-value--accent {
  color: #10b981;
}
.stat-label {
  font-size: var(--fs-label);
  color: var(--read-muted);
  margin-top: 4px;
  font-weight: 500;
}

@media (max-width: 640px) {
  #proprietary-notice {
    font-size: 11px;
    padding: 8px 12px;
  }
}

/* Print */
@media print {
  #topnav,
  #sidebar,
  #proprietary-notice,
  #moboverlay,
  .noprint {
    display: none !important;
  }
  #main {
    margin-left: 0 !important;
    padding-top: 0 !important;
  }
}
