/* ============================================================
   MatheMachine — design tokens & global styles
   ============================================================ */
:root {
  --bg: #FBFBFD;
  --bg-elev: #FFFFFF;
  --ink: #1D1D1F;
  --ink-2: #424246;
  --ink-3: #6E6E73;
  --ink-4: #A1A1A6;
  --line: #E8E8ED;
  --line-2: #D2D2D7;

  --dark-bg: #0A0B1E;
  --dark-bg-2: #11132A;
  --dark-ink: #F5F5F7;
  --dark-ink-2: #C7C7CC;
  --dark-ink-3: #86868B;
  --dark-line: rgba(255,255,255,0.08);

  --blue: #2D5BFF;
  --violet: #7B3FE4;
  --grad: linear-gradient(135deg, #2D5BFF 0%, #7B3FE4 100%);
  --grad-soft: linear-gradient(135deg, rgba(45,91,255,0.12) 0%, rgba(123,63,228,0.12) 100%);
  --grad-text: linear-gradient(135deg, #4A78FF 0%, #9B5FFF 100%);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 1px 2px rgba(15, 18, 50, 0.04), 0 1px 1px rgba(15, 18, 50, 0.02);
  --shadow: 0 1px 2px rgba(15, 18, 50, 0.04), 0 8px 24px rgba(15, 18, 50, 0.06);
  --shadow-lg: 0 1px 2px rgba(15, 18, 50, 0.04), 0 24px 56px rgba(15, 18, 50, 0.10);

  --content: 1240px;
  --gutter: 32px;

  --font-display: "Space Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.55;
  font-size: 17px;
  letter-spacing: -0.005em;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

::selection { background: rgba(45, 91, 255, 0.18); color: var(--ink); }

/* ----------------------- layout ----------------------- */
.container {
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

section {
  position: relative;
}

.section-pad {
  padding: 140px 0;
}
@media (max-width: 880px) { .section-pad { padding: 96px 0; } }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.dark .eyebrow, .eyebrow.on-dark { color: var(--dark-ink-3); }

.section-headline {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 18px 0 0;
  text-wrap: balance;
}

.section-sub {
  font-size: 19px;
  color: var(--ink-2);
  max-width: 640px;
  margin: 22px 0 0;
  line-height: 1.5;
  text-wrap: pretty;
}

.section-head {
  margin-bottom: 72px;
}

.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.section-divider {
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(45,91,255,0.18) 25%, rgba(123,63,228,0.18) 75%, transparent 100%);
  border: none;
  margin: 0;
}

/* ----------------------- buttons ----------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15.5px;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition: transform .25s cubic-bezier(.2,.7,.2,1), box-shadow .25s, background .25s, border-color .25s, color .25s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  color: #fff;
  background: var(--grad);
  box-shadow: 0 10px 30px rgba(45,91,255,0.30), inset 0 1px 0 rgba(255,255,255,0.20);
}
.btn-primary:hover {
  box-shadow: 0 14px 38px rgba(45,91,255,0.42), inset 0 1px 0 rgba(255,255,255,0.20);
  transform: translateY(-1px);
}

.btn-ghost {
  color: var(--ink);
  background: transparent;
  border-color: var(--line-2);
}
.btn-ghost:hover { border-color: var(--ink); background: rgba(0,0,0,0.025); }

.btn-ghost.on-dark {
  color: var(--dark-ink);
  border-color: rgba(255,255,255,0.22);
}
.btn-ghost.on-dark:hover { border-color: rgba(255,255,255,0.55); background: rgba(255,255,255,0.04); }

.btn-sm {
  height: 40px;
  padding: 0 18px;
  font-size: 14px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid var(--line-2);
  padding-bottom: 2px;
  transition: color .2s, border-color .2s, gap .2s;
}
.text-link:hover { gap: 12px; border-color: var(--blue); }
.text-link .arr { transition: transform .25s; }
.text-link:hover .arr { transform: translateX(2px); }

/* ----------------------- header ----------------------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 72px;
  display: flex;
  align-items: center;
  transition: background .35s ease, border-color .35s ease, backdrop-filter .35s ease, color .35s ease;
  border-bottom: 1px solid transparent;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.site-header .nav {
  display: flex;
  align-items: center;
  gap: 36px;
}
.site-header .nav a {
  font-size: 14.5px;
  font-weight: 500;
  color: inherit;
  opacity: 0.85;
  transition: opacity .2s;
}
.site-header .nav a:hover { opacity: 1; }
.site-header .nav a.is-current { opacity: 1; }

/* over-hero */
.site-header.over-hero { color: var(--dark-ink); }
/* scrolled */
.site-header.scrolled {
  background: rgba(251, 251, 253, 0.78);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom-color: var(--line);
  color: var(--ink);
}
/* light pages (non-hero): start in scrolled-style */
.site-header.on-light {
  color: var(--ink);
  background: rgba(251, 251, 253, 0.78);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom-color: var(--line);
}

.hamburger {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid currentColor;
  border-color: rgba(255,255,255,0.25);
  color: inherit;
}
.site-header.scrolled .hamburger,
.site-header.on-light .hamburger {
  border-color: var(--line-2);
}
.hamburger span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  position: relative;
}
.hamburger span::before,
.hamburger span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 1.5px;
  background: currentColor;
}
.hamburger span::before { top: -5px; }
.hamburger span::after { top: 5px; }

/* mobile sheet */
.mobile-sheet {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  transform: translateY(-100%);
  transition: transform .45s cubic-bezier(.7,0,.2,1);
  display: flex;
  flex-direction: column;
  padding: 24px var(--gutter);
}
.mobile-sheet.open { transform: translateY(0); }
.mobile-sheet .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}
.mobile-sheet .close {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: transparent;
  font-size: 20px;
  color: var(--ink);
}
.mobile-sheet nav {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mobile-sheet nav a {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.02em;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.mobile-sheet .cta-row {
  margin-top: auto;
  padding-bottom: 24px;
}

@media (max-width: 880px) {
  .site-header .nav .nav-item { display: none; }
  .site-header .nav .btn { display: none; }
  .hamburger { display: inline-flex; }
}

/* ----------------------- logo ----------------------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0;
  color: inherit;
}
.brand .mark {
  height: 40px;
  width: auto;
  display: block;
  flex-shrink: 0;
  border-radius: 8px;
  background: #0A0B1E;
  object-fit: contain;
  aspect-ratio: 4 / 3;
  box-shadow: 0 1px 2px rgba(15,18,50,0.06);
}
.site-footer .brand .mark { height: 48px; }
.mobile-sheet .brand .mark { height: 40px; }

/* ----------------------- footer ----------------------- */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 80px 0 36px;
}
.site-footer .cols {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 48px;
  align-items: start;
}
@media (max-width: 760px) {
  .site-footer .cols { grid-template-columns: 1fr; gap: 36px; }
}
.site-footer .brand-block .tagline {
  margin-top: 18px;
  color: var(--ink-3);
  font-size: 14.5px;
  max-width: 280px;
}
.site-footer h4 {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
  margin: 0 0 18px;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.site-footer ul a { font-size: 14.5px; color: var(--ink-2); transition: color .2s; }
.site-footer ul a:hover { color: var(--ink); }
.site-footer .contact a { font-size: 15px; color: var(--ink); }
.site-footer .bottom-strip {
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink-3);
  font-size: 13px;
}
.site-footer .bottom-strip .tiny {
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* ----------------------- floating math glyphs ----------------------- */
.glyph-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.glyph-bg .g {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 300;
  opacity: 0.045;
  color: var(--ink);
  user-select: none;
  line-height: 1;
}
.dark .glyph-bg .g { color: #fff; opacity: 0.05; }

/* ----------------------- orbital ring ----------------------- */
.orbital-bg {
  position: absolute;
  pointer-events: none;
  opacity: 0.55;
}

/* ----------------------- cards (light) ----------------------- */
.card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .35s, transform .35s;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity .35s;
  pointer-events: none;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card:hover::before { opacity: 1; }

/* ----------------------- form ----------------------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: -0.005em;
}
.field label .req { color: var(--blue); margin-left: 2px; }
.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(45,91,255,0.10);
}
.field.error input,
.field.error select,
.field.error textarea { border-color: #C7344E; }
.field .error-msg { font-size: 12.5px; color: #C7344E; display: none; }
.field.error .error-msg { display: block; }

.radio-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.radio-pill {
  flex: 1;
  min-width: 120px;
  position: relative;
}
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill .pill {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--ink-2);
  transition: all .2s;
  cursor: pointer;
}
.radio-pill input:checked + .pill {
  border-color: var(--blue);
  color: var(--ink);
  background: rgba(45,91,255,0.06);
  box-shadow: 0 0 0 3px rgba(45,91,255,0.08);
}

.chip-multi {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  font-size: 13.5px;
  color: var(--ink-2);
  background: var(--bg-elev);
  cursor: pointer;
  user-select: none;
  transition: all .2s;
}
.chip:hover { border-color: var(--ink-4); }
.chip.is-on {
  border-color: var(--blue);
  background: rgba(45,91,255,0.08);
  color: var(--ink);
}

/* ----------------------- dark stats / cta sections ----------------------- */
.section-dark {
  background: var(--dark-bg);
  color: var(--dark-ink);
  position: relative;
  overflow: hidden;
}
.section-dark::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 480px at 20% 0%, rgba(45,91,255,0.18) 0%, transparent 60%),
    radial-gradient(900px 480px at 100% 100%, rgba(123,63,228,0.18) 0%, transparent 60%);
  pointer-events: none;
}
.section-dark > * { position: relative; z-index: 1; }

/* ----------------------- animations ----------------------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1);
}
.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

@keyframes orbit-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes orbit-spin-rev {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes pulse-soft {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.85; }
}
