:root {
  --bg: #0b0c10;
  --panel: rgba(17, 18, 24, 0.78);
  --text: #e7e7ea;
  --muted: #a9a9b3;
  --border: rgba(255, 255, 255, 0.12);
  --link: #7aa2ff;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  --bg-grad-1: rgba(122, 162, 255, 0.25);
  --bg-grad-2: rgba(160, 122, 255, 0.18);
  --surface-soft: rgba(255, 255, 255, 0.06);
  --surface-soft-2: rgba(255, 255, 255, 0.10);
  --topbar-bg: rgba(11, 12, 16, 0.70);
  --btn-primary-bg: rgba(122, 162, 255, 0.20);
  --btn-primary-border: rgba(122, 162, 255, 0.35);
  --video-bg: rgba(0, 0, 0, 0.35);

  --radius: 18px;
  --content: 1040px;

  /* spacing scale */
  --s-1: 8px;
  --s0: 12px;
  --s1: 16px;
  --s2: 22px;
  --s3: 30px;
  --s4: 46px;
}

html[data-theme="light"] {
  --bg: #f4f1ea;
  --panel: rgba(255, 252, 245, 0.92);
  --text: #1f2430;
  --muted: #5f6572;
  --border: rgba(31, 36, 48, 0.12);
  --link: #175cd3;
  --shadow: 0 16px 36px rgba(99, 80, 43, 0.12);
  --bg-grad-1: rgba(244, 162, 97, 0.18);
  --bg-grad-2: rgba(96, 165, 250, 0.18);
  --surface-soft: rgba(31, 36, 48, 0.05);
  --surface-soft-2: rgba(31, 36, 48, 0.08);
  --topbar-bg: rgba(244, 241, 234, 0.82);
  --btn-primary-bg: rgba(23, 92, 211, 0.10);
  --btn-primary-border: rgba(23, 92, 211, 0.25);
  --video-bg: rgba(31, 36, 48, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn-video span:last-child {
    animation: none;
    background-position: 45% 50%;
  }
  .btn-dashboard::before {
    animation: none;
    opacity: 0.22;
    transform: scale(1);
  }
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 10% -10%, var(--bg-grad-1), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, var(--bg-grad-2), transparent 55%),
    var(--bg);
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

p, li { max-width: 75ch; }

.container {
  width: min(var(--content), calc(100% - 2 * var(--s1)));
  margin: 0 auto;
}

/* Accessibility */
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: var(--s1);
  top: var(--s1);
  width: auto;
  height: auto;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-soft-2);
  border: 1px solid var(--border);
  z-index: 999;
}

/* Type scales fluidly */
h1 {
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.15;
  margin: 0 0 var(--s0) 0;
}
h2 {
  font-size: clamp(20px, 2.4vw, 28px);
  margin: 0 0 var(--s0) 0;
}
h3 {
  font-size: clamp(16px, 2vw, 20px);
  margin: 0 0 var(--s-1) 0;
}

.subtitle { color: var(--muted); margin: 0 0 var(--s1) 0; }
.muted { color: var(--muted); }
.small { font-size: 0.95rem; }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s1);
  padding: var(--s0) 0;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--text);
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav a {
  color: var(--muted);
  font-weight: 650;
  padding: 6px 10px;
  border-radius: 12px;
}
.nav a:hover {
  color: var(--text);
  background: var(--surface-soft);
  text-decoration: none;
}

.menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.theme-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  padding: 0;
}

.theme-btn:hover {
  background: var(--surface-soft-2);
}

.theme-icon {
  grid-area: 1 / 1;
  font-size: 1rem;
  line-height: 1;
  transition: opacity 140ms ease, transform 140ms ease;
}

.theme-icon-sun {
  opacity: 0;
  transform: scale(0.8) rotate(-15deg);
}

.theme-icon-moon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

html[data-theme="light"] .theme-icon-sun {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

html[data-theme="light"] .theme-icon-moon {
  opacity: 0;
  transform: scale(0.8) rotate(15deg);
}

/* Mobile nav toggles using data-open */
.mobile-nav { display: none; padding-bottom: var(--s1); }
.mobile-nav[data-open="true"] { display: block; }

.mobile-nav a {
  display: block;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-weight: 650;
}

/* Hero */
.hero {
  padding: var(--s4) 0 var(--s2) 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s2);
  align-items: start;
}

.hero-text { min-width: 0; }

.cta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--s0);
  margin-bottom: var(--s1);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--btn-primary-bg);
  border: 1px solid var(--btn-primary-border);
  color: var(--text);
  font-weight: 750;
  text-decoration: none;
}

.btn > * {
  position: relative;
  z-index: 1;
}

.btn-icon-img {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.btn-report {
  background: transparent;
  border-color: var(--border);
  box-shadow: none;
}

.btn-report:hover {
  background: var(--surface-soft);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
}

.btn-dashboard {
  isolation: isolate;
}

.btn-dashboard::before {
  content: "";
  position: absolute;
  inset: -30%;
  z-index: 0;
  background: radial-gradient(circle, rgba(74, 222, 128, 0.34) 0%, rgba(56, 189, 248, 0.18) 30%, rgba(0, 0, 0, 0) 62%);
  opacity: 0.18;
  transform: scale(0.78);
  animation: dashboard-pop 2.6s ease-in-out infinite;
}

.btn-dashboard span:last-child {
  color: #d9ffe8;
  text-shadow: 0 0 14px rgba(74, 222, 128, 0.16);
}

html[data-theme="light"] .btn-dashboard span:last-child {
  color: #111827;
  text-shadow: none;
}

.btn-video {
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(239, 68, 68, 0.08);
}

.btn-video span:last-child {
  background-image: linear-gradient(
    110deg,
    #fca5a5 0%,
    #ffffff 18%,
    #fecaca 34%,
    #ef4444 50%,
    #ffffff 66%,
    #fca5a5 82%,
    #991b1b 100%
  );
  background-size: 220% auto;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: demo-sheen 2.8s linear infinite;
}

html[data-theme="light"] .btn-video span:last-child {
  background-image: linear-gradient(
    110deg,
    #7f1d1d 0%,
    #111827 18%,
    #991b1b 34%,
    #dc2626 50%,
    #111827 66%,
    #7f1d1d 82%,
    #000000 100%
  );
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
}

@keyframes demo-sheen {
  from { background-position: 0% 50%; }
  to { background-position: 220% 50%; }
}

@keyframes dashboard-pop {
  0%, 100% {
    opacity: 0.14;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.34;
    transform: scale(1.04);
  }
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 650;
  font-size: 0.9rem;
}

/* Sections */
.section {
  padding: var(--s3) 0;
  border-top: 1px solid var(--border);
}

.section-head {
  margin-bottom: var(--s1);
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s1);
  box-shadow: var(--shadow);
}

.callout {
  margin-top: var(--s1);
}

/* Responsive grid that collapses */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s1);
}

/* Team */
.team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.person {
  display: flex;
  gap: var(--s1);
  align-items: center;
}

.person-name { margin: 0; }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--text);
  flex: 0 0 auto;
}

.sep { opacity: 0.7; padding: 0 6px; }

.links-row {
  margin-top: var(--s1);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted);
}

/* Lists */
.link-list { margin: 10px 0 0 18px; }
.link-list li { margin: 6px 0; }

.key-results-strip {
  margin-top: var(--s1);
}

.key-results-strip ul {
  margin: 10px 0 0 18px;
}

.references {
  margin: 10px 0 0 18px;
}

.references li {
  margin: 8px 0;
}

/* Media helper: images scale down nicely */
.media {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.figure {
  margin: var(--s1) 0 0 0;
}

.figure a {
  display: block;
}

.figure .media {
  max-width: 100%;
}

.figure-compact {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.figure-readable {
  max-width: 100%;
}

.figure-readable a {
  margin: 0 auto;
}

.figure-readable .media {
  margin: 0 auto;
  width: min(100%, 980px);
}

.figure-screenshot .media {
  width: min(100%, 640px);
}

.figure-diagram .media {
  width: min(100%, 820px);
}

.figure-chart .media {
  width: min(100%, 680px);
}

.caption {
  margin: 8px 2px 0 2px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.figure-block {
  margin-top: var(--s1);
}

.figure-caption {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

.video-embed {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--video-bg);
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--s2) 0 var(--s3) 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.to-top {
  color: var(--muted);
  font-weight: 650;
}

/* Breakpoints */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .nav { display: none; }
  .menu-btn { display: inline-grid; place-items: center; }
  .grid { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: 1fr; }
  .figure-readable {
    overflow: visible;
    padding-bottom: 0;
  }
  .figure-readable a {
    min-width: 0;
    width: 100%;
  }
  .figure-readable .media {
    width: 100%;
    max-width: 100%;
  }
  .figure-screenshot a {
    min-width: 0;
  }
  .figure-screenshot .media {
    width: 100%;
  }
  .figure-diagram a {
    min-width: 0;
  }
  .figure-diagram .media {
    width: 100%;
  }
  .figure-chart a {
    min-width: 0;
  }
  .figure-chart .media {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .cta-row { grid-template-columns: 1fr; }
  .btn { text-align: center; width: 100%; }
  .topbar-inner { gap: 10px; }
  .topbar-actions { gap: 8px; }
  .theme-btn,
  .menu-btn { width: 38px; height: 38px; }
  .video-embed {
    border-radius: 14px;
  }
}
