/* ==========================================================================
   xMAD.ai — site stylesheet
   A restrained, editorial system: warm off-white paper, near-black ink,
   one accent colour, and type carried by scale and measure rather than colour.
   ========================================================================== */

/* ── Tokens ───────────────────────────────────────────────────────────── */
:root {
  /* colour */
  --paper:        #FBFAF8;
  --paper-2:      #F4F2EE;
  --ink:          #14141A;
  --ink-2:        #3A3A44;
  --muted:        #6E6E7A;
  --faint:        #9A9AA6;
  --line:         #E3E0D9;
  --line-strong:  #CFCBC1;
  --accent:       #2C4BE0;
  --accent-ink:   #FFFFFF;
  --dark:         #0E0E12;
  --dark-2:       #16161C;
  --dark-line:    #2A2A33;
  --dark-muted:   #A0A0AE;

  /* type */
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* rhythm */
  --shell: 1200px;
  --gutter: 28px;
  --section-y: 112px;
  --radius: 3px;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ── Reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1.1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.02em; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.u-visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: #fff; padding: 12px 18px;
}
.skip-link:focus { left: 12px; top: 12px; }

.shell { width: min(var(--shell), calc(100% - var(--gutter) * 2)); margin-inline: auto; }

/* ── Type scale ───────────────────────────────────────────────────────── */
.eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 20px;
}
.eyebrow--light { color: #8FA2FF; }

.hero__title {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  line-height: 1.03;
  letter-spacing: -0.033em;
  font-weight: 400;
  margin: 0 0 28px;
}
.hero__lede {
  font-size: clamp(1.06rem, 1.35vw, 1.28rem);
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 46ch;
  margin-bottom: 36px;
}
.section__title {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.028em;
  font-weight: 400;
  margin: 0 0 18px;
}
.section__lede { font-size: 1.04rem; color: var(--ink-2); max-width: 56ch; }
.section__lede--light { color: var(--dark-muted); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 11px 20px; font-size: 0.9rem; font-weight: 500;
  letter-spacing: -0.005em; cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease),
              border-color .18s var(--ease), transform .18s var(--ease);
}
.btn--lg { padding: 14px 26px; font-size: 0.95rem; }
.btn--solid { background: var(--ink); color: var(--paper); }
.btn--solid:hover { background: #2A2A34; transform: translateY(-1px); }
.btn--ghost { border-color: var(--line-strong); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); background: rgba(20, 20, 26, .04); }
.btn--text { padding: 0; color: var(--accent); font-weight: 500; }
.btn--text:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ── Announcement bar ─────────────────────────────────────────────────── */
.announce {
  background: var(--ink); color: #EDEDF2;
  font-size: 0.83rem; letter-spacing: -0.004em;
}
.announce__inner { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 9px 0; }
.announce p { margin: 0; display: flex; align-items: center; gap: 10px; }
.announce a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: #6FE39B; flex: none; }
.announce__close {
  position: absolute; right: var(--gutter); background: none; border: 0;
  color: #8A8A99; font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 4px 6px;
}
.announce__close:hover { color: #fff; }
.announce { position: relative; }
.announce.is-hidden { display: none; }

/* ── Masthead ─────────────────────────────────────────────────────────── */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.masthead.is-stuck { border-bottom-color: var(--line); }
.masthead__inner { display: flex; align-items: center; gap: 34px; padding: 17px 0; }

.wordmark { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); }
.wordmark svg { color: var(--ink); }
.wordmark__text { font-size: 1.06rem; font-weight: 600; letter-spacing: -0.028em; }
.wordmark__tld { color: var(--muted); font-weight: 400; }

.nav { display: flex; gap: 26px; margin-left: 12px; }
.nav a {
  font-size: 0.9rem; color: var(--ink-2); letter-spacing: -0.005em;
  padding: 4px 0; position: relative;
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0;
  height: 1px; background: var(--ink); transition: right .22s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { right: 0; }

.masthead__actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.menu-toggle {
  display: none; width: 40px; height: 40px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); background: none; cursor: pointer; padding: 0;
  align-items: center; justify-content: center;
}
.menu-toggle__bars, .menu-toggle__bars::before, .menu-toggle__bars::after {
  display: block; width: 16px; height: 1.5px; background: var(--ink); position: relative;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.menu-toggle__bars::before { content: ""; position: absolute; top: -5px; }
.menu-toggle__bars::after { content: ""; position: absolute; top: 5px; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars::before { transform: translateY(5px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars::after { transform: translateY(-5px) rotate(-45deg); }

.mobile-nav { border-top: 1px solid var(--line); background: var(--paper); }
.mobile-nav nav { display: grid; gap: 2px; padding: 14px 0 22px; }
.mobile-nav a { padding: 11px 0; font-size: 1.02rem; border-bottom: 1px solid var(--line); }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero { padding: clamp(64px, 10vw, 128px) 0 0; }
.hero .shell:first-child { padding-bottom: clamp(48px, 7vw, 84px); }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 26px; }

.statbar {
  display: grid; grid-template-columns: repeat(5, 1fr);
  margin: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.statbar__item { padding: 26px 24px 26px 0; border-right: 1px solid var(--line); }
.statbar__item:last-child { border-right: 0; }
.statbar__item:not(:first-child) { padding-left: 24px; }
.statbar dt {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.statbar dd {
  margin: 0; font-family: var(--serif); font-size: 1.72rem;
  letter-spacing: -0.02em; line-height: 1;
}

/* ── Logos ────────────────────────────────────────────────────────────── */
.logos { padding: 42px 0 46px; border-bottom: 1px solid var(--line); }
.logos__label {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 22px;
}
.logos__row {
  display: flex; flex-wrap: wrap; gap: 22px 52px; align-items: center;
}
.logos__row li {
  font-size: 1.02rem; font-weight: 500; letter-spacing: -0.01em;
  color: var(--muted); transition: color .2s var(--ease);
}
.logos__row li:hover { color: var(--ink); }

/* ── Sections ─────────────────────────────────────────────────────────── */
.section { padding: var(--section-y) 0; }
.section--bordered { border-bottom: 1px solid var(--line); }
.section__head { max-width: 62ch; margin-bottom: 62px; }
.section__head--split {
  max-width: none; display: flex; align-items: flex-end;
  justify-content: space-between; gap: 32px;
}

/* ── Research areas ───────────────────────────────────────────────────── */
.areas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.area {
  background: var(--paper); padding: 38px 34px 34px;
  display: flex; flex-direction: column; gap: 12px;
  transition: background .22s var(--ease);
}
.area:hover { background: var(--paper-2); }
.area__num {
  font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.06em;
  color: var(--faint);
}
.area__title { font-size: 1.24rem; font-weight: 500; letter-spacing: -0.018em; }
.area__body { color: var(--ink-2); font-size: 0.96rem; margin: 0; max-width: 44ch; }
.area__meta {
  margin: auto 0 0; padding-top: 18px; font-size: 0.8rem;
  color: var(--faint); letter-spacing: 0.02em;
}

/* ── Papers ───────────────────────────────────────────────────────────── */
.section--paper { background: var(--paper-2); border-bottom: 1px solid var(--line); }
.papers { display: grid; gap: 0; border-top: 1px solid var(--line-strong); }
.paper { padding: 38px 0 34px; border-bottom: 1px solid var(--line); }
.paper__meta {
  display: flex; align-items: center; gap: 14px;
  font-size: 0.79rem; color: var(--muted); margin-bottom: 14px;
  letter-spacing: 0.01em;
}
.paper__venue { color: var(--faint); }
.tag {
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 100px; border: 1px solid var(--line-strong);
  color: var(--muted);
}
.tag--new { background: var(--accent); border-color: var(--accent); color: #fff; }
.paper__title {
  font-family: var(--serif); font-size: clamp(1.34rem, 2.2vw, 1.72rem);
  font-weight: 400; letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 10px;
  max-width: 40ch;
}
.paper__title a:hover { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.paper__authors { font-size: 0.9rem; color: var(--muted); margin: 0 0 12px; }
.paper__abstract { font-size: 0.97rem; color: var(--ink-2); max-width: 68ch; margin: 0 0 16px; }
.paper__links { display: flex; gap: 18px; font-size: 0.88rem; margin: 0; }
.paper__links a { color: var(--accent); }
.paper__links a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ── Dark section (models) ────────────────────────────────────────────── */
.section--dark { background: var(--dark); color: #E9E9EF; }
.section--dark .section__title { color: #fff; }

.table-wrap { overflow-x: auto; border: 1px solid var(--dark-line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; min-width: 620px; font-size: 0.94rem; }
.table th, .table td { text-align: left; padding: 16px 20px; border-bottom: 1px solid var(--dark-line); }
.table thead th {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--dark-muted); font-weight: 500; background: var(--dark-2);
}
.table tbody th { font-weight: 500; color: #fff; }
.table tbody tr:last-child th, .table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .18s var(--ease); }
.table tbody tr:hover { background: rgba(255, 255, 255, .03); }
.table-note { margin-top: 16px; font-size: 0.84rem; color: var(--dark-muted); }
.table-note a { color: #9DB0FF; text-decoration: underline; text-underline-offset: 3px; }

/* ── Safety ───────────────────────────────────────────────────────────── */
.safety { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 64px; }
.safety__col--body p:first-child { margin-top: 6px; font-size: 1.04rem; color: var(--ink-2); max-width: 62ch; }
.checklist { margin: 26px 0 30px; display: grid; gap: 12px; }
.checklist li {
  position: relative; padding-left: 26px; font-size: 0.96rem; color: var(--ink-2);
}
.checklist li::before {
  content: ""; position: absolute; left: 0; top: 0.55em;
  width: 11px; height: 6px; border-left: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent); transform: rotate(-45deg);
}

/* ── Quote ────────────────────────────────────────────────────────────── */
.quote { padding: clamp(72px, 9vw, 116px) 0; border-bottom: 1px solid var(--line); }
.quote__block { margin: 0; max-width: 46ch; }
.quote__block p {
  font-family: var(--serif); font-size: clamp(1.5rem, 3.1vw, 2.3rem);
  line-height: 1.28; letter-spacing: -0.028em; margin: 0 0 26px;
}
.quote__block footer { display: flex; flex-direction: column; gap: 2px; font-size: 0.92rem; }
.quote__name { font-weight: 500; }
.quote__role { color: var(--muted); }

/* ── Roles ────────────────────────────────────────────────────────────── */
.roles { border-top: 1px solid var(--line-strong); }
.role { border-bottom: 1px solid var(--line); }
.role a {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 24px 4px; transition: padding .2s var(--ease), background .2s var(--ease);
}
.role a:hover { padding-left: 14px; background: var(--paper-2); }
.role__title { font-size: 1.08rem; font-weight: 500; letter-spacing: -0.015em; }
.role__meta { font-size: 0.87rem; color: var(--muted); text-align: right; flex: none; }

/* ── Signup ───────────────────────────────────────────────────────────── */
.signup { background: var(--paper-2); border-bottom: 1px solid var(--line); padding: 72px 0; }
.signup__inner { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 28px 48px; }
.signup__title {
  font-family: var(--serif); font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  font-weight: 400; letter-spacing: -0.026em; margin: 0 0 8px;
}
.signup__lede { margin: 0; color: var(--muted); font-size: 0.96rem; max-width: 48ch; }
.signup__form { display: flex; gap: 10px; }
.signup__form input {
  width: 320px; padding: 12px 16px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); background: #fff;
}
.signup__form input:focus { outline: none; border-color: var(--ink); }
.signup__note { grid-column: 1 / -1; margin: 0; font-size: 0.9rem; color: var(--accent); }

/* ── Footer ───────────────────────────────────────────────────────────── */
.footer { background: var(--paper); padding: 72px 0 34px; }
.footer__top {
  display: grid; grid-template-columns: 1.1fr 2.4fr; gap: 56px;
  padding-bottom: 54px; border-bottom: 1px solid var(--line);
}
.wordmark--footer { margin-bottom: 16px; }
.footer__blurb { color: var(--muted); font-size: 0.94rem; max-width: 30ch; margin-bottom: 20px; }
.footer__address { font-style: normal; font-size: 0.88rem; color: var(--faint); line-height: 1.7; }
.footer__nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; }
.footer__col { display: flex; flex-direction: column; gap: 10px; }
.footer__col h3 {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink); margin-bottom: 4px; font-weight: 600;
}
.footer__col a { font-size: 0.9rem; color: var(--muted); }
.footer__col a:hover { color: var(--ink); }
.footer__bottom {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px; padding-top: 26px;
  font-size: 0.84rem; color: var(--faint);
}
.footer__bottom p { margin: 0; }
.footer__social { display: flex; gap: 20px; }
.footer__social a { color: var(--muted); }
.footer__social a:hover { color: var(--ink); }

/* ── Reveal on scroll ─────────────────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .statbar { grid-template-columns: repeat(3, 1fr); }
  .statbar__item:nth-child(3n) { border-right: 0; }
  .statbar__item:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .statbar__item:nth-child(3n + 1) { padding-left: 0; }
  .safety { grid-template-columns: 1fr; gap: 28px; }
  .footer__top { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 900px) {
  :root { --section-y: 78px; --gutter: 22px; }
  .nav, .masthead__actions .btn--ghost { display: none; }
  .menu-toggle { display: flex; }
  .areas { grid-template-columns: 1fr; }
  .logos__row { gap: 16px 32px; }
  .logos__row li { font-size: 0.95rem; }
  .signup__inner { grid-template-columns: 1fr; }
  .signup__form input { width: 100%; }
  .footer__nav { grid-template-columns: repeat(2, 1fr); gap: 28px; }
}

@media (max-width: 620px) {
  .announce__inner { justify-content: flex-start; padding-right: 34px; }
  .announce p { font-size: 0.78rem; }
  .hero__actions { gap: 16px; }
  .btn--lg { width: 100%; }
  .statbar { grid-template-columns: repeat(2, 1fr); }
  .statbar__item:nth-child(3n) { border-right: 1px solid var(--line); }
  .statbar__item:nth-child(2n) { border-right: 0; }
  .statbar__item:nth-child(3n + 1) { padding-left: 24px; }
  .statbar__item:nth-child(2n + 1) { padding-left: 0; }
  .section__head--split { flex-direction: column; align-items: flex-start; }
  .role a { flex-direction: column; align-items: flex-start; gap: 6px; }
  .role__meta { text-align: left; }
  .footer__bottom { flex-direction: column; align-items: flex-start; }
}
