/* AI Checklist — the same paper look as the SOTA site and the IOAI Guide:
   STIX Two Text, ink on white, hairline rules, red for focus, blue for links.
   The grid adds three status colors. Light only. */

:root {
  --paper: #FFFFFF;
  --ink: #16161D;
  --graphite: #5F6070;
  --hairline: #DCDCE3;
  --plate: #F5F5F8;
  --red: #B31B1B;
  --blue: #1F48C7;

  /* Problem statuses: a strong color for text and bars, a pale tint for the cell */
  --st-progress: #8F6D00;
  --st-progress-bg: #FBF3DC;
  --st-solved: #1B6642;
  --st-solved-bg: #E3F1E8;
  --st-helped: #1F48C7;
  --st-helped-bg: #E8EDFB;

  --serif: "STIX Two Text", "STIX Two", Cambria, "Times New Roman", serif;
  --topbar-h: 58px;
  --wide: 1240px;

  color-scheme: light;
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 72px);
}

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

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

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: 2px; }

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

.num { font-variant-numeric: tabular-nums; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  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;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-inline: 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: block;
  width: 30px;
  height: 15px;
  fill: currentColor;
  shape-rendering: crispEdges;
}
.brand-name {
  font-size: 20px;
  font-weight: 700;
  font-variant-caps: all-small-caps;
  letter-spacing: .08em;
  white-space: nowrap;
}

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

/* ---------- page ---------- */

.page {
  max-width: var(--wide);
  margin-inline: auto;
  padding: 36px clamp(16px, 4vw, 40px) 96px;
}

/* Title block and overall progress */
.summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  align-items: end;
  gap: 20px 56px;
  padding: 20px 0 24px;
  border-top: 4px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.summary-single { grid-template-columns: minmax(0, 1fr); }
.summary-text { display: grid; gap: 8px; }

.eyebrow {
  font-size: 15px;
  font-variant-caps: all-small-caps;
  letter-spacing: .08em;
  color: var(--graphite);
}
h1 {
  font-size: clamp(28px, 3.6vw, 38px);
  line-height: 1.12;
  font-weight: 700;
  text-wrap: balance;
}
.lede {
  max-width: 66ch;
  font-size: 17px;
  color: var(--graphite);
}

.overall { display: grid; gap: 8px; }
.overall-count { font-size: 16px; color: var(--graphite); }
.overall-count strong {
  margin-right: 4px;
  font-size: 32px;
  line-height: 1;
  color: var(--ink);
}
.overall-detail { font-size: 14.5px; color: var(--graphite); }

.bar {
  display: flex;
  height: 10px;
  background: var(--plate);
  box-shadow: inset 0 0 0 1px var(--hairline);
  overflow: hidden;
}
.seg { width: 0; transition: width .25s ease; }
.seg-solved { background: var(--st-solved); }
.seg-helped { background: var(--st-helped); }
.seg-progress { background: var(--st-progress); }

/* Filters and saving, kept in view while scrolling the grid */
.toolbar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  padding-block: 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.toolbar-label {
  margin-right: 4px;
  font-size: 15px;
  font-variant-caps: all-small-caps;
  letter-spacing: .08em;
  color: var(--graphite);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 4px;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.3;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--hairline);
  cursor: pointer;
}
.chip:hover { border-color: var(--graphite); }
.chip .n { color: var(--graphite); }
.chip[aria-pressed="true"] {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}
.chip[aria-pressed="true"] .n { color: color-mix(in srgb, var(--paper) 72%, var(--ink)); }

.swatch {
  width: 10px;
  height: 10px;
  border: 1px solid transparent;
}
.swatch-none { border-color: var(--graphite); }
.swatch-progress { background: var(--st-progress); }
.swatch-solved { background: var(--st-solved); }
.swatch-helped { background: var(--st-helped); }
.chip[aria-pressed="true"] .swatch-none { border-color: var(--paper); }

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 14.5px;
}
.tool {
  padding: 0;
  font: inherit;
  color: var(--blue);
  background: none;
  border: 0;
  cursor: pointer;
}
.tool:hover { text-decoration: underline; text-underline-offset: 2px; }
/* The file input is hidden, so the Import label shows focus for it */
#import-file:focus-visible + .tool,
.tools label:has(+ #import-file:focus-visible) { outline: 2px solid var(--red); outline-offset: 2px; }

.noscript {
  margin-top: 16px;
  padding: 10px 14px;
  font-size: 15.5px;
  background: var(--plate);
}

/* ---------- the grid ---------- */

.source {
  display: grid;
  gap: 4px;
  margin-top: 44px;
}
.source-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ink);
}
.source-head h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 14px;
  font-size: 26px;
  line-height: 1.2;
}
.source-full {
  font-size: 16px;
  font-weight: 400;
  color: var(--graphite);
}
.source-progress {
  font-size: 15px;
  color: var(--graphite);
}

.contests {
  list-style: none;
  padding: 0;
}

/* One row per contest round: label, the problems, and a count. Every row in a source
   has the same number of columns (--cols), so problems line up down the page. */
.contest {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr) 3.25rem;
  align-items: start;
  gap: 16px;
  padding-block: 12px;
  border-bottom: 1px solid var(--hairline);
}

.contest-label {
  display: grid;
  gap: 1px;
  padding-top: 2px;
}
.contest-year {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}
.contest-round {
  font-size: 15.5px;
  line-height: 1.3;
  color: var(--ink);
}
.contest-round:hover { color: var(--blue); }
.contest-place {
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--graphite);
}

.contest-progress {
  padding-top: 6px;
  font-size: 15px;
  text-align: right;
  color: var(--graphite);
}
.contest.is-complete .contest-progress {
  font-weight: 700;
  color: var(--st-solved);
}

.cells {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: 8px;
}

.cell {
  position: relative;
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 5.25rem;
  padding: 8px 10px 10px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  transition: background-color .15s ease, border-color .15s ease, opacity .15s ease;
}
.cell:hover { border-color: var(--graphite); }

/* The whole cell is the status button; the problem name is a link laid on top of it */
.cell-toggle {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}
.cell-toggle:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
.cell > :not(.cell-toggle) {
  position: relative;
  pointer-events: none;
}
.cell > .cell-name { pointer-events: auto; }

/* The label stays on one line; in a narrow cell the status drops below it */
.cell-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 6px;
  font-size: 13px;
  line-height: 1.3;
}
.cell-label {
  color: var(--graphite);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cell-state {
  font-size: 13.5px;
  font-weight: 600;
  font-variant-caps: all-small-caps;
  letter-spacing: .06em;
  white-space: nowrap;
}
.cell-name {
  justify-self: start;
  font-size: 15.5px;
  line-height: 1.3;
  color: var(--ink);
  overflow-wrap: break-word;
  hyphens: auto;
}
.cell-name:hover { color: var(--blue); }
.cell-area,
.cell-note {
  font-size: 13px;
  line-height: 1.35;
  color: var(--graphite);
}
.cell-note { font-style: italic; }

.cell[data-status="progress"] { background: var(--st-progress-bg); border-color: color-mix(in srgb, var(--st-progress) 40%, var(--paper)); }
.cell[data-status="solved"] { background: var(--st-solved-bg); border-color: color-mix(in srgb, var(--st-solved) 40%, var(--paper)); }
.cell[data-status="helped"] { background: var(--st-helped-bg); border-color: color-mix(in srgb, var(--st-helped) 40%, var(--paper)); }
.cell[data-status="progress"] .cell-state { color: var(--st-progress); }
.cell[data-status="solved"] .cell-state { color: var(--st-solved); }
.cell[data-status="helped"] .cell-state { color: var(--st-helped); }

/* Filtering fades the other problems instead of hiding them, so the grid keeps its shape */
body[data-filter="none"] .cell:not([data-status=""]),
body[data-filter="progress"] .cell:not([data-status="progress"]),
body[data-filter="solved"] .cell:not([data-status="solved"]),
body[data-filter="helped"] .cell:not([data-status="helped"]) {
  opacity: .28;
}

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

.footer { border-top: 1px solid var(--hairline); }
.footer-inner {
  max-width: var(--wide);
  margin-inline: auto;
  padding: 28px clamp(16px, 4vw, 40px) 40px;
  display: grid;
  gap: 6px;
  font-size: 14.5px;
  color: var(--graphite);
}

/* ---------- narrower screens ---------- */

@media (max-width: 1100px) {
  .cells { grid-template-columns: repeat(var(--cols-md), minmax(0, 1fr)); }
  .contest { grid-template-columns: 9.5rem minmax(0, 1fr) 3rem; }
}

@media (max-width: 720px) {
  body { font-size: 17px; }
  .topbar { gap: 10px; padding-inline: 16px; }
  .top-links { gap: 14px; }
  .top-links .opt { display: none; }
  .summary { grid-template-columns: minmax(0, 1fr); }
  /* Chips wrap onto several lines here, so the toolbar scrolls with the page */
  .toolbar { position: static; }
  .contest {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
  }
  .contest-label {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
  }
  /* The count sits beside the round name, above the problems */
  .contest-progress {
    grid-row: 1;
    grid-column: 2;
    padding-top: 2px;
  }
  .cells {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

@media print {
  .topbar, .toolbar, .skip, .footer { display: none !important; }
  body { font-size: 10pt; }
  .page { max-width: none; padding: 0; }
  .contest { break-inside: avoid; }
  a { color: inherit; }
}
