/* dEngine — site styles */
:root {
  --bg: #FCFBF7;
  --ink: #22261F;
  --muted: #6B6F66;
  --faint: #8E9188;
  --line: #E6E3DA;
  --panel: #F3F2EC;
  --cta: #F1EAD6;
  --accent: #9A7A45;
  --sun: #F5C33B;
  --radius: 10px;
  --max: 1040px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.02em; }
p { margin: 0; }
var { font-style: normal; }
sub, sup { font-size: 0.7em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px; z-index: 10;
}
.skip-link:focus { left: 8px; }

.eyebrow {
  font-size: 11px; font-weight: 500; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted);
}
.num { font-size: 11px; color: var(--accent); font-variant-numeric: tabular-nums; }
.lead { color: var(--muted); font-size: 15px; line-height: 1.6; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 26px; border-radius: 6px;
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, transform .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #343a2f; }
.btn-outline { background: #fff; border-color: var(--line); }
.btn-outline:hover { border-color: #cfcbbf; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 5; background: rgba(252,251,247,.92); backdrop-filter: blur(8px); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 78px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.nav { display: flex; gap: 44px; margin-left: auto; margin-right: 90px; font-size: 13px; }
.nav a { opacity: .85; }
.nav a:hover { opacity: 1; }

/* Hero */
.hero { text-align: center; padding: 80px 0 30px; }
.hero h1 {
  font-size: clamp(44px, 7vw, 66px); line-height: 1.02; letter-spacing: -0.035em;
  max-width: 520px; margin: 0 auto;
}
.hero-sub { margin-top: 26px; font-size: 19px; color: var(--muted); }
.hero-tag { margin-top: 8px; font-size: 13px; color: var(--muted); }
.hero-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 26px; }

.objective {
  position: relative; margin: 38px auto 0; max-width: 716px;
  background: var(--panel); border-radius: var(--radius); padding: 18px 24px 22px;
}
.objective .eyebrow { position: absolute; top: 18px; left: 24px; font-size: 9px; }
.formula { font-size: 21px; padding: 14px 0 0; color: var(--ink); overflow-x: auto; overflow-y: hidden; }
.formula .katex-display { margin: 0; }

/* KaTeX in body text */
.katex { font-size: 1.1em; }
.steps .math-block { margin-top: 10px; font-size: 13px; }
.steps .math-block .katex-display { margin: 0; text-align: left; }
.steps .math-block .katex-display > .katex { text-align: left; }
.steps .math-block + p { margin-top: 4px; }

/* Pillars */
.pillars { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 30px; }
.pillars-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.pillar { padding: 36px 30px 44px 0; }
.pillar + .pillar { border-left: 1px solid var(--line); padding-left: 30px; }
.pillar h2 { margin-top: 18px; font-size: 19px; letter-spacing: -0.01em; }
.pillar p { margin-top: 12px; font-size: 13.5px; color: var(--muted); max-width: 290px; }

/* Overview */
.overview { padding: 64px 0 72px; border-bottom: 1px solid var(--line); }
.overview-grid { display: grid; grid-template-columns: 1fr 1.75fr; gap: 60px; }
.display { margin-top: 12px; font-size: clamp(30px, 4vw, 36px); line-height: 1.12; letter-spacing: -0.03em; }
.overview-intro .lead { margin-top: 32px; max-width: 280px; }

.steps { list-style: none; margin: 0; padding: 0; }
.steps li {
  display: grid; grid-template-columns: 80px 1fr;
  padding: 0 0 26px; border-bottom: 1px solid var(--line);
}
.steps li + li { padding-top: 22px; }
.steps .num { padding-top: 4px; }
.steps h3 { font-size: 15px; letter-spacing: -0.005em; }
.steps p { margin-top: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.7; max-width: 560px; }

/* Resources */
.resources { padding: 40px 0 60px; }
.display-sm { margin-top: 14px; font-size: clamp(26px, 3.5vw, 32px); letter-spacing: -0.03em; }
.lead.wide { margin-top: 18px; max-width: 100%; }
.papers { list-style: none; margin: 18px 0 0; padding: 0; }
.paper {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 0 20px;
  padding: 22px 0 26px; border-bottom: 1px solid var(--line);
}
.paper:first-child { padding-top: 6px; }
.paper .num { padding-top: 4px; }
.paper h3 { font-size: 16px; letter-spacing: -0.005em; line-height: 1.45; max-width: 640px; }
.paper .meta { margin-top: 8px; font-size: 11px; color: var(--faint); }
.paper-body > p:last-child { margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.paper-link { font-size: 11.5px; font-weight: 500; white-space: nowrap; padding: 2px 40px 0 40px; }
.paper-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* CTA */
.cta-wrap { padding: 40px 0 0; }
.cta {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  background: var(--cta); border-radius: var(--radius); padding: 30px 40px 58px;
}
.cta .eyebrow { font-size: 9.5px; }
.cta h2 { margin-top: 10px; font-size: clamp(22px, 3vw, 27px); letter-spacing: -0.02em; }
.cta p:last-child { margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.cta .btn { padding: 13px 44px; flex-shrink: 0; }

/* Contact */
.contact { padding: 0; }
.contact-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px;
  border-top: 1px solid var(--line); margin-top: 30px; padding-top: 40px; padding-bottom: 80px;
}
.contact-grid > div { padding: 0; }
.contact .lead { margin-top: 18px; }
.contact-cta { padding-top: 34px !important; }
.contact-cta p { font-size: 15px; color: var(--muted); line-height: 1.6; max-width: 420px; }
.email {
  display: inline-block; margin-top: 20px;
  font-size: clamp(20px, 2.6vw, 24px); border-bottom: 1.5px solid var(--ink); line-height: 1.25;
}

/* Footer */
.footer-inner {
  display: flex; align-items: center; gap: 100px;
  border-top: 1px solid var(--line); padding: 40px 24px 60px;
}
.footer-brand { font-size: 19px; font-weight: 500; }
.footer-text { font-size: 11px; color: var(--muted); }
.footer-inner a { margin-left: auto; margin-right: 50px; font-size: 11.5px; font-weight: 500; }

/* Responsive */
@media (max-width: 860px) {
  .nav { margin-right: 24px; gap: 24px; }
  .overview-grid { grid-template-columns: 1fr; gap: 36px; }
  .overview-intro .lead { max-width: none; margin-top: 18px; }
  .footer-inner { gap: 24px; flex-wrap: wrap; }
  .footer-inner a { margin-right: 0; }
}
@media (max-width: 720px) {
  .nav, .header-cta { display: none; }
  .hero { padding-top: 56px; }
  .formula { font-size: 14px; }
  .objective { padding-top: 40px; padding-bottom: 28px; }
  .pillars-grid { grid-template-columns: 1fr; }
  .pillar, .pillar + .pillar { padding: 28px 0; border-left: 0; }
  .pillar + .pillar { border-top: 1px solid var(--line); }
  .steps li { grid-template-columns: 48px 1fr; }
  .paper { grid-template-columns: 36px 1fr; }
  .paper-link { grid-column: 2; padding: 12px 0 0; }
  .cta { flex-direction: column; align-items: flex-start; padding: 28px 24px 32px; }
  .contact-grid { grid-template-columns: 1fr; gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}

.hero-logo {
  display: flex;
  justify-content: center;
  max-width: none;
  margin: 0 auto;
  line-height: 0;
}
.hero-logo img {
  width: 140px;
  height: auto;
}

.contact {
  padding-block: clamp(2.5rem, 5vw, 4rem);
}

.contact-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
}

.contact-text .eyebrow { margin: 0 0 0.5rem; }
.contact-text h2       { margin: 0 0 0.75rem; }
.contact-text p:last-child {
  margin: 0;
  max-width: 52ch;
}

.steps li:last-child {
  border-bottom: none;
}
