/* The style sheet of olymmath. One file, no framework. The design is flat: no corner is rounded, no rule goes under a heading and no shadow lifts a block. Space and pale fields of colour set the blocks apart. The only lines are the bars at the left of a statement and of a solution. The colours are custom properties, and the dark theme changes only these properties. */

@font-face { font-family: "NewCM"; src: url("fonts/newcm-book.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "NewCM"; src: url("fonts/newcm-bookitalic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "NewCM"; src: url("fonts/newcm-bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "NewCM"; src: url("fonts/newcm-bolditalic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --surface-2: #eceef2;
  --ink: #16181d;
  --ink-2: #393e47;
  --muted: #687080;
  --rule: #dfe3e9;
  --accent: #3366cc;
  --accent-soft: #e8eefa;
  --brand: #7d1f33;
  --brand-ink: #ffffff;
  /* Each kind of block has an ink and a pale field. */
  --stmt: #2a4b8d;
  --stmt-soft: #eef3fc;
  --green: #14613a;
  --green-soft: #e5f5ec;
  --clay: #8a4a0b;
  --clay-soft: #fbefe4;
  --plum: #6b3a8c;
  --plum-soft: #f3ebf8;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "NewCM", "Latin Modern Roman", "CMU Serif", "Iowan Old Style", Georgia, serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --wrap: 68rem;
  --measure: 44rem;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121418;
  --surface: #1a1d23;
  --surface-2: #22262e;
  --ink: #e7e9ed;
  --ink-2: #c4c9d2;
  --muted: #8f97a5;
  --rule: #2e333c;
  --accent: #8fb0ff;
  --accent-soft: #1d2843;
  --brand: #b0485d;
  --brand-ink: #ffffff;
  --stmt: #9db8f0;
  --stmt-soft: #19212f;
  --green: #7fd1a3;
  --green-soft: #16291f;
  --clay: #e8a874;
  --clay-soft: #2c2119;
  --plum: #cfa6ec;
  --plum-soft: #261d30;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 19px/1.66 var(--serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; color: var(--ink); }
h1 { font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem); margin: 0.3rem 0 0.7rem; }
h2 { font-size: 1.6rem; margin: 3rem 0 1rem; }
h3 { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.35rem; }
code, kbd { font-family: var(--mono); font-size: 0.8em; }
code { background: var(--surface-2); padding: 0.08em 0.32em; }
kbd { background: var(--surface-2); padding: 0.05em 0.4em; color: var(--ink-2); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.5rem; }
.sr, .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--accent); color: #fff; padding: 0.5rem 0.8rem; font: 600 0.9rem var(--sans); z-index: 10; }
.skip:focus { left: 0.5rem; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 5; background: var(--surface); }
.top-row { display: flex; align-items: center; gap: 1.75rem; height: 3.5rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.mark { display: grid; place-items: center; width: 2rem; height: 2rem; background: var(--brand); color: var(--brand-ink); font: italic 400 1.15rem/1 var(--serif); letter-spacing: -0.02em; padding-bottom: 0.12rem; }
.brand-text { font: 400 1.25rem/1 var(--serif); }
.nav { display: flex; gap: 0.1rem; margin-left: auto; overflow-x: auto; font-family: var(--sans); }
.nav a { color: var(--ink-2); font-weight: 500; font-size: 0.86rem; padding: 0.45rem 0.75rem; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); background: var(--bg); }
.theme { border: 0; background: transparent; color: var(--muted); width: 2.2rem; height: 2.2rem; display: grid; place-items: center; cursor: pointer; flex: none; }
.theme svg { width: 1rem; height: 1rem; }
.theme:hover { color: var(--ink); background: var(--surface-2); }

body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1 0 auto; width: 100%; padding-bottom: 5rem; }

/* Home */
.hero { padding: 5rem 0 1rem; max-width: 50rem; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); line-height: 1.04; letter-spacing: -0.01em; margin: 0.6rem 0 1.4rem; }
.eyebrow { color: var(--brand); font: 600 0.74rem/1.4 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; margin: 0; }
.lede { color: var(--ink-2); font-size: 1.12rem; max-width: var(--measure); margin: 0 0 1.75rem; }

.search-box { display: flex; max-width: 40rem; background: var(--bg); box-shadow: inset 0 0 0 1px var(--rule); }
.search-box:focus-within { box-shadow: inset 0 0 0 1px var(--accent); }
.search-box input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 400 1rem var(--serif); padding: 0.8rem 1rem; }
.search-box input:focus { outline: none; }
.search-box input::placeholder { color: var(--muted); font-style: italic; }
.search-box button, .button { display: inline-flex; align-items: center; gap: 0.4rem; border: 0; background: var(--ink); color: var(--bg); font: 600 0.86rem var(--sans); padding: 0.7rem 1.2rem; cursor: pointer; }
.button.ghost { background: var(--surface); color: var(--ink); }
.button:hover, .search-box button:hover { background: var(--accent); color: #fff; text-decoration: none; }
.actions { display: flex; gap: 2px; flex-wrap: wrap; margin: 0; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; margin: 3rem 0 0; max-width: 40rem; }
.stats div { display: flex; flex-direction: column-reverse; background: var(--surface); padding: 1rem 1.2rem; }
.stats dt { color: var(--muted); font: 600 0.7rem/1.4 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; }
.stats dd { margin: 0; font: 400 2rem/1.2 var(--serif); font-variant-numeric: tabular-nums; }

.block { margin-top: 4rem; }
.block > h2, .block-head h2 { margin: 0 0 1.1rem; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.block-head a { font: 500 0.86rem var(--sans); }

.grid { display: grid; gap: 2px; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 2.5rem; }
.tile { display: flex; flex-direction: column; gap: 0.15rem; padding: 1.2rem 1.3rem 1.3rem; background: var(--surface); color: var(--ink); }
.tile:hover { background: var(--accent-soft); box-shadow: inset 0 3px 0 var(--accent); text-decoration: none; }
.tile-kicker { color: var(--accent); font: 600 0.7rem/1.4 var(--sans); text-transform: uppercase; letter-spacing: 0.1em; }
.tile-title { font: 400 1.25rem/1.3 var(--serif); margin: 0.2rem 0 0.35rem; }
.tile-meta { color: var(--muted); font: 400 0.8rem/1.5 var(--sans); }
.principles { margin-top: 5rem; }
.principles h3 { font-size: 1.15rem; }
.principles p { color: var(--ink-2); margin: 0; font-size: 1rem; }

/* Statements and solutions */
.statement-card { background: var(--stmt-soft); box-shadow: inset 3px 0 0 var(--stmt); padding: 1.3rem 1.6rem 1.4rem 1.8rem; margin: 0 0 1.75rem; max-width: var(--measure); }
.card-kicker { margin: 0 0 0.5rem; font: 600 0.74rem/1.4 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--stmt); }
.card-kicker a { color: inherit; }
.card-foot { margin: 0.9rem 0 0; font: 500 0.84rem var(--sans); }
.statement { overflow-wrap: break-word; hyphens: auto; }
.statement p { margin: 0 0 0.8rem; }
.statement p:last-child { margin-bottom: 0; }
.statement ul, .statement ol { padding-left: 1.4rem; margin: 0 0 0.8rem; }
.statement li { margin: 0.25rem 0; }
.statement .katex { font-size: 1.02em; }
.statement .katex-display { margin: 0.8rem 0; overflow-x: auto; overflow-y: hidden; padding: 0.2rem 0; }
.math-error { color: #b42318; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 2px; padding: 0; margin: 0 0 1.25rem; font-family: var(--sans); }
.chips li { font-size: 0.74rem; font-weight: 500; padding: 0.2rem 0.6rem; background: var(--surface-2); color: var(--ink-2); }
.chips .chip-A { background: var(--stmt-soft); color: var(--stmt); }
.chips .chip-C { background: var(--clay-soft); color: var(--clay); }
.chips .chip-G { background: var(--green-soft); color: var(--green); }
.chips .chip-N { background: var(--plum-soft); color: var(--plum); }
.statement-card .chips li { background: var(--bg); }

.source { margin: 1.1rem 0 0; color: var(--muted); font: 400 0.8rem/1.6 var(--sans); }
.badge { display: inline-block; font: 600 0.66rem/1.6 var(--sans); padding: 0.05rem 0.45rem; background: var(--surface-2); color: var(--ink-2); margin-right: 0.35rem; letter-spacing: 0.08em; text-transform: uppercase; vertical-align: 0.08em; }
.badge-H1, .badge-sol-official { background: var(--green-soft); color: var(--green); }
.badge-H2, .badge-sol-human { background: var(--accent-soft); color: var(--accent); }
.badge-sol-ai { background: var(--plum-soft); color: var(--plum); }
.statement-card .badge { background: var(--bg); }

.solution { box-shadow: inset 1px 0 0 var(--rule); padding: 0.2rem 0 0.2rem 1.6rem; margin: 0 0 2.5rem; max-width: var(--measure); }
.solution .card-kicker { display: flex; align-items: center; gap: 0.2rem; color: var(--muted); text-transform: none; letter-spacing: 0; font-size: 0.82rem; font-weight: 500; }
.solution .statement::after { content: "\220E"; display: block; text-align: right; color: var(--muted); margin-top: 0.4rem; }

.reveal { background: var(--surface); margin: 0 0 1.75rem; max-width: var(--measure); }
.reveal summary { cursor: pointer; padding: 0.8rem 1.4rem; font: 500 0.86rem var(--sans); color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 0.6rem; }
.reveal summary::-webkit-details-marker { display: none; }
.reveal summary::before { content: "+"; font-size: 1.1rem; width: 0.8rem; color: var(--accent); }
.reveal[open] summary::before { content: "\2212"; }
.reveal summary:hover { color: var(--ink); }
.reveal .statement { padding: 0 1.4rem 1.2rem 2.8rem; }

.empty { background: var(--surface); padding: 1.2rem 1.5rem; color: var(--ink-2); max-width: var(--measure); font-size: 1rem; }
.empty p { margin: 0 0 0.5rem; }
.empty p:last-child { margin: 0; font: 500 0.86rem var(--sans); }

/* Pages */
.crumbs { display: flex; flex-wrap: wrap; gap: 0.35rem; font: 400 0.8rem var(--sans); color: var(--muted); padding-top: 2rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs > * + *::before { content: "/"; margin-right: 0.35rem; opacity: 0.6; }
.page-head { margin-bottom: 2rem; max-width: var(--measure); }
.page-head .lede { margin-bottom: 1.2rem; }
.paper { margin-top: 3.5rem; }
.paper-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.paper-head h2 { margin: 0; }
.paper-head p { margin: 0; color: var(--muted); font: 400 0.84rem var(--sans); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 2px; margin: 0 0 1.5rem; }
.facts div { background: var(--surface); padding: 0.8rem 1.1rem; }
.facts dt { color: var(--muted); font: 600 0.68rem/1.5 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; }
.facts dd { margin: 0.15rem 0 0; overflow-wrap: anywhere; font-size: 1rem; }
.prose { max-width: var(--measure); }
.prose li { margin: 0.4rem 0; }

.table-wrap { overflow-x: auto; }
table.years { width: 100%; border-collapse: collapse; font: 400 0.9rem/1.5 var(--sans); }
.years th, .years td { text-align: left; padding: 0.6rem 1rem; vertical-align: middle; }
.years thead th { font-size: 0.68rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; background: var(--surface-2); }
.years tbody tr:nth-child(even) { background: var(--surface); }
.years tbody th { font: 400 1.05rem var(--serif); }
.cells { list-style: none; display: flex; gap: 2px; padding: 0; margin: 0; flex-wrap: wrap; }
.cells a { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; background: var(--green-soft); color: var(--green); font-weight: 600; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.cells a:hover { background: var(--green); color: var(--bg); text-decoration: none; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-top: 3rem; max-width: var(--measure); }
.pager a { display: flex; flex-direction: column; padding: 0.9rem 1.2rem; background: var(--surface); color: var(--ink); font: 400 1.1rem var(--serif); }
.pager a span { color: var(--muted); font: 600 0.68rem/1.6 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; }
.pager a:hover { background: var(--accent-soft); text-decoration: none; }
.pager-next { text-align: right; grid-column: 2; }
.meta-line { color: var(--muted); font: 400 0.8rem/1.8 var(--sans); margin-top: 1.5rem; max-width: var(--measure); }

.results { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; gap: 2px; max-width: 50rem; }
.results li a { display: block; padding: 1rem 1.3rem; background: var(--surface); color: var(--ink); }
.results li a:hover { background: var(--accent-soft); text-decoration: none; }
.results .r-title { font: 600 0.84rem var(--sans); color: var(--accent); }
.results .r-text { color: var(--ink-2); font-size: 0.98rem; margin-top: 0.25rem; }
.results mark { background: var(--accent-soft); color: inherit; padding: 0 0.1em; }

/* Directory of competitions */
.filter input { width: 100%; max-width: 30rem; font: 400 1rem var(--serif); padding: 0.75rem 1rem; border: 0; box-shadow: inset 0 0 0 1px var(--rule); background: var(--bg); color: var(--ink); }
.filter input:focus { outline: none; box-shadow: inset 0 0 0 1px var(--accent); }
.filter input::placeholder { color: var(--muted); font-style: italic; }
.jump { display: flex; flex-wrap: wrap; gap: 2px; margin: 1.1rem 0 0.5rem; font-family: var(--sans); }
.jump a { font-size: 0.8rem; font-weight: 500; padding: 0.35rem 0.8rem; background: var(--surface); color: var(--ink-2); }
.jump a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.group > .country { margin-bottom: 0.4rem; }
.group[id="national"] { columns: 2 22rem; column-gap: 3rem; }
.group[id="national"] h2 { column-span: all; }
.group[id="national"] .country { break-inside: avoid; margin-bottom: 1.5rem; }
.country h3 { font: 600 0.7rem/1.4 var(--sans); text-transform: uppercase; letter-spacing: 0.1em; color: var(--brand); margin: 0 0 0.4rem; }
.directory { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); column-gap: 3rem; }
.group[id="national"] .directory { display: block; }
.directory li { display: flex; align-items: baseline; justify-content: space-between; gap: 0.8rem; padding: 0.3rem 0.5rem; margin: 0 -0.5rem; }
.directory li:hover { background: var(--surface); }
.directory a { color: var(--ink); min-width: 0; font-size: 1rem; line-height: 1.45; }
.directory a:hover { text-decoration: none; }
.directory a:hover .dir-name { color: var(--accent); }
.dir-code { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.dir-meta { display: flex; gap: 0.6rem; align-items: baseline; color: var(--muted); font: 400 0.78rem var(--sans); white-space: nowrap; }
.dir-count { font-weight: 600; color: var(--green); background: var(--green-soft); padding: 0.05rem 0.45rem; font-size: 0.72rem; }

/* Footer */
.foot { background: var(--surface); color: var(--muted); font: 400 0.82rem/1.65 var(--sans); }
.foot-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2.5rem; padding-top: 2.75rem; padding-bottom: 3rem; }
.foot-brand { color: var(--ink); font: 400 1.15rem var(--serif); margin: 0 0 0.35rem; }
.foot-head { color: var(--ink); font-weight: 600; margin: 0 0 0.35rem; }
.foot p { margin: 0; }
.foot a { color: var(--ink-2); }

@media (max-width: 720px) {
  body { font-size: 17.5px; }
  .wrap { padding: 0 1.1rem; }
  .top-row { gap: 0.6rem; }
  .brand-text { display: none; }
  .nav a { padding: 0.45rem 0.5rem; font-size: 0.82rem; }
  .hero { padding-top: 3rem; }
  .statement-card { padding: 1.1rem 1.1rem 1.2rem 1.3rem; }
  .solution { padding-left: 1.1rem; }
  .stats div { padding: 0.8rem 0.9rem; }
  .stats dd { font-size: 1.6rem; }
  .foot-row { grid-template-columns: 1fr; gap: 1.4rem; }
}

@media print {
  .top, .foot, .crumbs, .actions, .card-foot, .pager, .meta-line, .reveal, .block, .skip { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .statement-card { background: none; box-shadow: none; padding: 0 0 1rem; max-width: none; }
  .paper { break-after: page; }
  a { color: inherit; }
}
