/* SOTA – AI Community
   The site is laid out like a machine learning paper: one serif (STIX Two Text),
   booktabs-style tables, and boxed links like LaTeX hyperref.
   Light only, like a printed page. */

:root {
  --paper: #FFFFFF;
  --ink: #16161D;
  --graphite: #5F6070;
  --hairline: #DCDCE3;
  --plate: #F2F2F5;
  --red: #B31B1B;
  --blue: #1F48C7;
  --shade: rgb(22 22 29 / .16);

  --measure: 680px;
  --serif: "STIX Two Text", "STIX Two", Cambria, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Vertical rhythm, like a paper: tight inside a section, a big gap between sections.
     Keep --space-section several times larger than --space-block so sections read as blocks. */
  --space-section: 144px; /* between sections */
  --space-block: 16px;    /* between a heading and its content, and between paragraphs */
  --space-item: 32px;     /* between repeated items: programs, biographies, FAQ entries */

  color-scheme: light;
}

@media (max-width: 560px) {
  :root {
    --space-section: 104px;
    --space-block: 14px;
    --space-item: 26px;
  }
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  font-variant-numeric: lining-nums;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ol, ul, figure, table { margin: 0; }

img { display: block; max-width: 100%; height: auto; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

sup { line-height: 0; }

::selection { background: color-mix(in srgb, var(--red) 22%, transparent); }

.mono { font-family: var(--mono); font-size: .82em; }
.sc { font-variant-caps: all-small-caps; letter-spacing: .06em; }

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 20;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 6px 10px;
}
.skip:focus { left: 8px; }

/* Boxed link, like hyperref's red link borders */
.box {
  display: inline-block;
  border: 1px solid var(--red);
  color: var(--ink);
  padding: 2px 10px 3px;
  line-height: 1.35;
}
.box:hover {
  background: var(--red);
  color: var(--paper);
  text-decoration: none;
}
.box.strong { font-weight: 600; }

.cite { white-space: nowrap; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
}

.topbar-inner {
  max-width: 1040px;
  margin-inline: auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
}

.brand {
  display: flex;
  align-items: center;
  padding-block: 6px;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
/* The pixel mark: a 6×3 grid, sized in whole pixels per cell so edges stay crisp */
.brand-mark {
  display: block;
  width: 36px;
  height: 18px;
  fill: currentColor;
  shape-rendering: crispEdges;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px 28px;
  font-size: 16px;
}
.nav a:not(.box) { color: var(--ink); }

@media (max-width: 600px) {
  .nav { gap: 4px 16px; }
  .nav .opt { display: none; }
  .brand-mark { width: 30px; height: 15px; }
}

/* ---------- paper ---------- */

.paper {
  position: relative;
  max-width: calc(var(--measure) + 40px);
  margin-inline: auto;
  padding: 80px 20px 128px;
}

/* Rotated identifier in the left margin, like a preprint */
.stamp {
  position: absolute;
  top: 176px;
  left: -64px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 15px;
  letter-spacing: .02em;
  color: var(--graphite);
  white-space: nowrap;
  user-select: none;
}
@media (max-width: 1000px) {
  .stamp { display: none; }
}

/* ---------- contents rail (wide screens only) ---------- */

.toc { display: none; }

@media (min-width: 1280px) {
  .toc {
    display: block;
    position: fixed;
    left: 28px;
    top: 50%;
    z-index: 5;
    width: 180px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.35;
    transform: translateY(-50%);
  }
}

/* Between 1280px and 1439px the rail and the margin stamp would crowd each other */
@media (min-width: 1280px) and (max-width: 1439px) {
  .stamp { display: none; }
}

.toc-title {
  margin: 0 0 8px 13px;
  font-size: 14px;
  font-variant-caps: all-small-caps;
  letter-spacing: .08em;
  color: var(--graphite);
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* A hairline track down the left; the section in view gets a red mark on it */
.toc-list { border-left: 1px solid var(--hairline); }

.toc a {
  display: grid;
  grid-template-columns: 2.2em minmax(0, 1fr);
  margin-left: -1px;
  padding: 3px 0 3px 12px;
  border-left: 2px solid transparent;
  color: var(--graphite);
}
.toc li li a {
  padding-left: 24px;
  font-size: 12px;
}
.toc a:hover {
  color: var(--ink);
  text-decoration: none;
}
.toc a.is-active {
  color: var(--ink);
  border-left-color: var(--red);
}
.toc .toc-appendix { margin-top: 10px; }

.title {
  border-top: 4px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 26px 8px 28px;
  text-align: center;
}
.title h1 {
  font-size: clamp(26px, 4.2vw, 34px);
  line-height: 1.18;
  font-weight: 700;
  text-wrap: balance;
}

.authors {
  list-style: none;
  padding: 0;
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: space-between;
  gap: 28px 24px;
  text-align: center;
}
.authors li { display: grid; gap: 4px; align-content: start; }
.authors a { color: var(--ink); font-weight: 600; line-height: 1.3; }
.authors span { font-size: 14.5px; color: var(--graphite); line-height: 1.35; }
@media (max-width: 640px) {
  .authors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.correspondence {
  margin-top: 28px;
  text-align: center;
  font-size: 14.5px;
  color: var(--graphite);
}

.abstract {
  max-width: 600px;
  margin: 72px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.abstract h2 {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}
.abstract p { text-align: justify; hyphens: auto; }
.keywords { font-size: 15.5px; }
.keywords b { font-style: italic; }

.actions {
  margin-top: 44px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px 32px;
}

/* ---------- sections ---------- */

/* minmax(0, 1fr) columns stop wide tables from stretching the page on phones */
.section {
  margin-top: var(--space-section);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-block);
}
.section > h2 {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.25;
}
.section h3 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}
.section p { text-align: justify; hyphens: auto; }

/* Numbered heading: "2.1  Monthly contests" */
.hn { display: flex; align-items: baseline; gap: 1em; }
.num { font-variant-numeric: tabular-nums; }

.lead { color: var(--graphite); font-style: italic; }

.pairs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-item) 48px;
}
.pairs > div { display: grid; gap: 6px; align-content: start; }
.section .pairs p { text-align: left; }
@media (max-width: 640px) {
  .pairs { grid-template-columns: 1fr; }
}

/* Displayed equation with its number on the right */
.eq {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-block: 8px;
  font-size: 20px;
}
.eq-body {
  grid-column: 2;
  display: inline-flex;
  align-items: baseline;
  gap: .3em;
  white-space: nowrap;
}
.eq-n { grid-column: 3; justify-self: end; font-size: 18px; }
.argmax {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.25;
}
.argmax sub {
  vertical-align: baseline;
  font-size: .7em;
  font-style: italic;
  line-height: 1;
}

/* ---------- tables ---------- */

.table {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}
.table figcaption {
  font-size: 15.5px;
  text-align: center;
  text-wrap: balance;
}

/* Wide tables scroll sideways on phones; soft edge shadows show there is more */
.scroll {
  overflow-x: auto;
  background:
    linear-gradient(to right, var(--paper) 40%, transparent) left / 28px 100% no-repeat local,
    linear-gradient(to left, var(--paper) 40%, transparent) right / 28px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--shade), transparent) left / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--shade), transparent) right / 12px 100% no-repeat scroll;
}

.booktabs {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.45;
  font-variant-numeric: lining-nums tabular-nums;
}
.booktabs th,
.booktabs td {
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}
.booktabs thead th {
  font-weight: 600;
  white-space: nowrap;
  border-top: 1.5px solid var(--ink);
  border-bottom: .8px solid var(--ink);
}
.booktabs tbody th { font-weight: 400; white-space: nowrap; }
.booktabs tbody tr:last-child > * { border-bottom: 1.5px solid var(--ink); }
.booktabs .mid > * { border-top: .8px solid var(--ink); }
.booktabs .r { text-align: right; white-space: nowrap; }
.booktabs .quiet { color: var(--graphite); }

.past { min-width: 560px; }

/* ---------- algorithm ---------- */

.algorithm {
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  font-size: 17px;
}
.algorithm figcaption {
  padding: 8px 2px;
  border-bottom: .8px solid var(--ink);
}
.algorithm .io {
  padding: 12px 2px 6px;
  display: grid;
  gap: 2px;
}
.algorithm ol {
  list-style: none;
  padding: 4px 2px 14px;
  counter-reset: line;
  display: grid;
}
.algorithm li {
  counter-increment: line;
  display: grid;
  grid-template-columns: 2.2em minmax(0, 1fr);
  line-height: 1.75;
}
.algorithm li::before {
  content: counter(line) ":";
  font-size: .8em;
  color: var(--graphite);
  text-align: right;
  padding-right: .7em;
  padding-top: .25em;
}
.algorithm .in { padding-left: 1.5em; }
.kw { font-weight: 700; }

/* ---------- author biographies ---------- */

.bios {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-item) 48px;
}
.bio {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.bio img {
  width: 96px;
  height: 120px;
  object-fit: cover;
  background: var(--plate);
}
.bio > div { display: grid; gap: 6px; align-content: start; }
.bio h3 { font-size: 17px; }
.section .bio p { text-align: left; font-size: 15.5px; line-height: 1.5; color: var(--graphite); }
.bio a { font-size: 15.5px; }
@media (max-width: 640px) {
  .bios { grid-template-columns: 1fr; }
}

/* ---------- references and appendix ---------- */

.refs {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 16px;
}
.refs li {
  display: grid;
  grid-template-columns: 2.4em minmax(0, 1fr);
  overflow-wrap: anywhere;
}

/* The one divider on the page: where the main text ends and the appendices begin */
.appendix {
  margin-top: var(--space-section);
  padding-top: calc(var(--space-section) * .5);
  border-top: 1px solid var(--ink);
}
.faq { display: grid; gap: var(--space-item); }
.faq > div { display: grid; gap: 6px; }

/* ---------- footer ---------- */

.footer { border-top: 1px solid var(--hairline); }
.footer-inner {
  max-width: calc(var(--measure) + 40px);
  margin-inline: auto;
  padding: 32px 20px 44px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 24px;
  font-size: 14.5px;
  color: var(--graphite);
}

/* ---------- small screens ---------- */

@media (max-width: 560px) {
  body { font-size: 17px; }
  .paper { padding-top: 52px; padding-bottom: 96px; }
  .title { padding-block: 20px 22px; }
  .authors { margin-top: 36px; gap: 24px 16px; }
  .correspondence { margin-top: 24px; }
  .abstract { margin-top: 52px; }
  .actions { margin-top: 36px; }
  .section p, .abstract p { text-align: left; }
  .eq { font-size: 18px; grid-template-columns: 0 auto 1fr; }
  .booktabs { font-size: 15px; }
  .booktabs th, .booktabs td { padding: 8px 8px; }
  .past { min-width: 0; }
  .past tbody th { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- print: it is a paper, after all ---------- */

@media print {
  :root {
    --paper: #FFFFFF;
    --ink: #000000;
    --graphite: #444444;
    --hairline: #CCCCCC;
    --red: #B31B1B;
    --blue: #000000;
    --space-section: 28pt;
    --space-block: 8pt;
    --space-item: 12pt;
  }
  body { font-size: 11pt; }
  .topbar, .stamp, .toc, .actions, .skip { display: none; }
  .paper { max-width: none; padding: 0; }
  .section { break-inside: avoid-page; }
  .box { border: 0; padding: 0; }
  .scroll { background: none; }
}
