/* eSpyMath public website — v13 clean stylesheet
   One authoritative cascade. No legacy version patches. */

:root {
  color-scheme: light;
  --page: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f7f5;
  --surface-3: #f1f1ee;
  --ink: #151515;
  --muted: #666a67;
  --line: #e3e3de;
  --line-strong: #cdcdc6;
  --green: #5f8f46;
  --green-soft: #eef5e9;
  --orange: #d8752f;
  --orange-soft: #fff1e7;
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.055);
  --shadow-md: 0 16px 42px rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --max: 1160px;
  --header-h: 64px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f1110;
  --surface: #151715;
  --surface-2: #1a1d1b;
  --surface-3: #20231f;
  --ink: #f3f3ef;
  --muted: #a8ada8;
  --line: #2d312e;
  --line-strong: #404541;
  --green: #91b77a;
  --green-soft: #1d2819;
  --orange: #e6975d;
  --orange-soft: #302117;
  --shadow-sm: none;
  --shadow-md: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
h1, h2, h3, p { margin-top: 0; }
.shell { width: min(var(--max), calc(100% - 40px)); margin-inline: auto; }

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 247, 245, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
html[data-theme="dark"] .header { background: rgba(15, 17, 16, 0.96); }
.nav {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  color: #000;
  font-size: 18px;
  font-weight: 780;
  letter-spacing: -0.035em;
  line-height: 1;
}
.brand img { width: 28px; height: 28px; }
.brand b, .brand span { color: #000; font-style: normal; }
html[data-theme="dark"] .header .brand,
html[data-theme="dark"] .footer .brand {
  padding: 5px 8px;
  border-radius: 7px;
  background: #f7f7f5;
}
.menu {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 13px;
  font-weight: 620;
  color: var(--muted);
}
.menu a { transition: color .15s ease; }
.menu a:hover, .menu a[aria-current="page"] { color: var(--ink); }
.nav-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.menu-toggle {
  display: none;
  border: 0;
  padding: 7px;
  background: transparent;
  color: var(--ink);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--line-strong); }
.theme-icon { width: 14px; text-align: center; }

/* Controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid #111;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); background: #2a2a2a; border-color: #2a2a2a; }
.btn.small { padding: 8px 11px; font-size: 12px; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--muted); }
.text-link, .editorial-link {
  color: var(--ink);
  font-size: 13px;
  font-weight: 690;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color .15s ease;
}
.text-link:hover, .editorial-link:hover { text-decoration-color: currentColor; }

/* Shared labels */
.eyebrow, .kicker {
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .105em;
  text-transform: uppercase;
}
.eyebrow { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.orange-dot { background: var(--orange); }
.kicker { margin-bottom: 8px; }
.kicker.student { color: var(--green); }
.orange-kicker { color: var(--orange); }

/* Minimal landing */
.v10-hero {
  padding: 62px 0 50px;
  border-bottom: 1px solid var(--line);
  background: var(--page);
}
.v10-hero-inner { max-width: 780px; }
.v10-hero h1 {
  margin: 14px 0 12px;
  max-width: 760px;
  font-size: clamp(34px, 4vw, 46px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.045em;
}
.v10-hero p {
  max-width: 700px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}
.v10-products { padding: 22px 0 58px; }
.v10-configurator {
  display: grid;
  grid-template-columns: minmax(300px, .72fr) minmax(0, 1.28fr);
  gap: 38px;
  align-items: center;
  padding: 42px 0;
  border-bottom: 1px solid var(--line);
}
.v10-copy h2, .v10-section-label h2 {
  margin: 0 0 10px;
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.035em;
}
.v10-copy p {
  max-width: 520px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.62;
}
.v10-scope {
  margin-bottom: 19px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.v10-scope span { margin: 0 4px; color: var(--line-strong); }
.v12-config-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.v12-config-infographic {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-md);
  transition: transform .18s ease, box-shadow .18s ease;
}
.v12-config-infographic:hover { transform: translateY(-2px); }
.v12-config-infographic img { width: 100%; height: auto; }
html[data-theme="dark"] .v12-config-infographic { background: #f7f7f5; }
.v10-helper-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  padding: 34px 0 8px;
}
.v10-helper { min-height: 150px; padding: 4px 0; }
.v10-helper h2 {
  margin: 0 0 7px;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.v10-helper p { max-width: 480px; margin-bottom: 10px; color: var(--muted); font-size: 14px; }
.v10-status { color: var(--muted); font-size: 11.5px; }
.v10-team-section { padding: 52px 0 62px; border-top: 1px solid var(--line); background: var(--surface-2); }
.v10-section-label { max-width: 680px; margin-bottom: 24px; }
.v10-section-label p { margin: 7px 0 0; color: var(--muted); font-size: 13.5px; }
.v10-team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line); }
.v10-team-grid article { padding: 20px 20px 18px 0; border-bottom: 1px solid var(--line); }
.team-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  font-size: 10px;
  font-weight: 760;
}
.v10-team-grid h3 { margin: 0 0 3px; font-size: 16px; }
.v10-team-grid p { margin: 0; color: var(--muted); font-size: 12px; }

/* Shared subpage hero */
.v10-page-hero {
  padding: 52px 0 38px;
  border-bottom: 1px solid var(--line);
  background: var(--page);
}
.v10-page-hero h1 {
  max-width: 760px;
  margin: 12px 0 9px;
  font-size: clamp(32px, 3.7vw, 42px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.04em;
}
.v10-page-hero p { max-width: 760px; margin-bottom: 0; color: var(--muted); font-size: 15.5px; line-height: 1.65; }

/* R&D page */
.v10-rd-overview { padding: 34px 0; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.v10-rd-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr auto 1fr; align-items: stretch; gap: 8px; }
.v10-rd-flow > div {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.v10-rd-flow b { display: block; margin-bottom: 4px; font-size: 13px; }
.v10-rd-flow span { display: block; color: var(--muted); font-size: 11px; line-height: 1.45; }
.v10-rd-flow i { align-self: center; color: var(--muted); font-style: normal; font-size: 12px; }
.v10-rd-flow .rd-output { background: #111; color: #fff; border-color: #111; }
.v10-rd-flow .rd-output span { color: #c7c7c2; }
html[data-theme="dark"] .v10-rd-flow .rd-output { background: #f2f2ee; color: #111; border-color: #f2f2ee; }
html[data-theme="dark"] .v10-rd-flow .rd-output span { color: #666; }
.v10-rd-section { padding: 48px 0 58px; }
.v10-rd-tools { background: var(--surface-2); border-top: 1px solid var(--line); }
.v10-rd-grid, .v10-tools-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.v10-rd-grid article, .v10-tools-grid > a, .v10-tools-grid > article {
  min-width: 0;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.v10-rd-grid h3, .v10-tools-grid h3 { margin: 0 0 6px; font-size: 15px; line-height: 1.3; }
.v10-rd-grid p, .v10-tools-grid p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.v10-tools-grid span { display: block; margin-bottom: 7px; color: var(--orange); font-size: 9px; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
.v10-tools-grid b { display: block; margin-top: 12px; font-size: 11px; }
.v10-tools-grid > a { transition: border-color .15s ease, transform .15s ease; }
.v10-tools-grid > a:hover { transform: translateY(-1px); border-color: var(--line-strong); }

/* Books */
.v10-books { padding: 42px 0 62px; }
.v10-book-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.v10-book-grid a {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .15s ease, transform .15s ease;
}
.v10-book-grid a:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.v10-book-grid span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; font-weight: 760; text-transform: uppercase; letter-spacing: .08em; }
.v10-book-grid h2 { margin: 0 0 12px; font-size: 15px; line-height: 1.35; letter-spacing: -0.015em; }
.v10-book-grid b { font-size: 11px; }
.v10-books-all { margin-top: 20px; }

/* Configurator product page */
.config-product-hero { padding: 54px 0 44px; border-bottom: 1px solid var(--line); background: var(--page); }
.config-product-hero-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr); gap: 44px; align-items: center; }
.config-product-hero h1 {
  margin: 12px 0 10px;
  font-size: clamp(34px, 4vw, 46px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.045em;
}
.config-lead { max-width: 620px; margin-bottom: 11px; color: var(--muted); font-size: 15.5px; line-height: 1.65; }
.config-scope-line { margin-bottom: 19px; color: var(--muted); font-size: 12px; font-weight: 650; }
.config-scope-line span { margin: 0 5px; color: var(--line-strong); }
.config-hero-actions { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.config-mini-flow { display: flex; align-items: center; gap: 7px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.config-mini-flow > div { flex: 1; min-width: 0; padding: 11px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.config-mini-flow small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.config-mini-flow span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 9px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.config-mini-flow b { display: block; font-size: 11px; line-height: 1.3; }
.config-mini-flow i { color: var(--muted); font-size: 10px; font-style: normal; }
.config-mini-flow .config-mini-output { background: #111; color: #fff; border-color: #111; }
.config-mini-flow .config-mini-output span, .config-mini-flow .config-mini-output small { color: #bdbdb8; }
html[data-theme="dark"] .config-mini-flow .config-mini-output { background: #f2f2ee; color: #111; border-color: #f2f2ee; }
html[data-theme="dark"] .config-mini-flow .config-mini-output span,
html[data-theme="dark"] .config-mini-flow .config-mini-output small { color: #666; }
.config-proof-strip { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.config-proof-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.config-proof-grid > div { padding: 15px 18px; border-right: 1px solid var(--line); }
.config-proof-grid > div:first-child { border-left: 1px solid var(--line); }
.config-proof-grid b { display: block; margin-bottom: 1px; font-size: 18px; line-height: 1.2; letter-spacing: -0.02em; }
.config-proof-grid span { color: var(--muted); font-size: 10px; }
.config-features { padding: 50px 0 58px; }
.config-section-heading { max-width: 680px; margin-bottom: 25px; }
.config-section-heading h2, .config-research-inner h2, .config-final-cta h2 {
  margin: 6px 0 8px;
  font-size: clamp(24px, 2.7vw, 31px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.035em;
}
.config-section-heading p, .config-research-inner p, .config-final-cta p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.62; }
.config-feature-list { border-top: 1px solid var(--line); }
.config-feature-list article { display: grid; grid-template-columns: 42px 1fr; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.config-feature-list article > span { padding-top: 2px; color: var(--muted); font-size: 10px; }
.config-feature-list h3 { margin: 0 0 4px; font-size: 15px; }
.config-feature-list p { max-width: 820px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.58; }
.config-research-link { padding: 36px 0; border-block: 1px solid var(--line); background: var(--surface-2); }
.config-research-inner { display: flex; align-items: end; justify-content: space-between; gap: 28px; }
.config-research-inner > div { max-width: 710px; }
.config-final-cta { padding: 46px 0 54px; text-align: center; }
.config-final-cta p { margin-bottom: 15px; }
.config-learn-link { display: inline-block; margin-left: 10px; }

/* Footer */
.footer { padding: 38px 0 20px; border-top: 1px solid var(--line); background: var(--surface); }
.footer-grid { display: grid; grid-template-columns: 1.6fr .7fr .7fr; gap: 34px; }
.footer .brand { margin-bottom: 11px; }
.footer h3 { margin: 1px 0 9px; color: var(--muted); font-size: 10px; font-weight: 760; text-transform: uppercase; letter-spacing: .08em; }
.footer p, .footer a { display: block; margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.footer a:hover { color: var(--ink); }
.copyright { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10.5px; }

/* Responsive */
@media (max-width: 1000px) {
  .v10-configurator { grid-template-columns: 1fr; gap: 27px; }
  .v12-config-infographic { max-width: 900px; }
  .config-product-hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .config-mini-flow { max-width: 760px; }
  .v10-book-grid { grid-template-columns: repeat(2, 1fr); }
  .v10-rd-grid, .v10-tools-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  :root { --header-h: 58px; }
  .nav { gap: 14px; }
  .brand { font-size: 16px; }
  .brand img { width: 25px; height: 25px; }
  .menu-toggle { display: inline-block; }
  .menu {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: var(--header-h);
    margin: 0;
    padding: 14px 20px 18px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(247, 247, 245, 0.99);
  }
  html[data-theme="dark"] .menu { background: rgba(15, 17, 16, 0.99); }
  .menu.open { display: flex; }
  .menu a { padding: 9px 2px; border-bottom: 1px solid var(--line); }
  .menu a:last-child { border-bottom: 0; }
  .v10-rd-flow { grid-template-columns: 1fr; }
  .v10-rd-flow i { font-size: 0; text-align: center; }
  .v10-rd-flow i::after { content: "↓"; font-size: 11px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .shell { width: min(var(--max), calc(100% - 28px)); }
  .theme-text { display: none; }
  .theme-toggle { padding-inline: 8px; }
  .nav-actions .btn.small { display: none; }
  .v10-hero { padding: 46px 0 36px; }
  .v10-hero h1 { font-size: 33px; }
  .v10-hero p { font-size: 15px; }
  .v10-products { padding-bottom: 42px; }
  .v10-configurator { padding: 31px 0; }
  .v10-copy h2, .v10-section-label h2 { font-size: 25px; }
  .v10-copy p { font-size: 14px; }
  .v10-helper-grid { grid-template-columns: 1fr; gap: 20px; padding-top: 28px; }
  .v10-helper { min-height: 0; padding: 0 0 13px; }
  .v10-team-section { padding: 42px 0 48px; }
  .v10-team-grid { grid-template-columns: 1fr; }
  .v10-team-grid article { padding-right: 0; }
  .v10-page-hero { padding: 42px 0 31px; }
  .v10-page-hero h1 { font-size: 31px; }
  .v10-page-hero p { font-size: 14.5px; }
  .v10-rd-section { padding: 38px 0 44px; }
  .v10-rd-grid, .v10-tools-grid, .v10-book-grid { grid-template-columns: 1fr; }
  .config-product-hero { padding: 42px 0 34px; }
  .config-product-hero h1 { font-size: 33px; }
  .config-lead { font-size: 14.5px; }
  .config-mini-flow { display: grid; grid-template-columns: 1fr; gap: 5px; padding: 13px; }
  .config-mini-flow i { font-size: 0; text-align: center; }
  .config-mini-flow i::after { content: "↓"; font-size: 10px; }
  .config-proof-grid { grid-template-columns: repeat(2, 1fr); }
  .config-proof-grid > div:nth-child(3), .config-proof-grid > div:nth-child(4) { border-top: 1px solid var(--line); }
  .config-features { padding: 39px 0 45px; }
  .config-feature-list article { grid-template-columns: 31px 1fr; gap: 10px; }
  .config-research-inner { align-items: flex-start; flex-direction: column; }
  .config-final-cta { padding: 39px 0 46px; }
  .config-learn-link { margin-left: 8px; }
  .footer-grid { grid-template-columns: 1fr; gap: 18px; }
}

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