/* Type: 12 meta, 14 body, 16 names and data, 20 headings, 34 the title. Weights 400, 500, 700. */
:root {
  --bg: #fff;
  --ink: #0b0b0c;
  --ink-2: #55555b;
  --line: #e7e7ea;
  --hover: #f5f5f7;
  --accent: #5b53e6;
  --gold: #86610a;
  --rule: 1.5px solid var(--ink);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --w: 1080px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0b0c;
  --ink: #f5f5f7;
  --ink-2: #a3a3aa;
  --line: #242428;
  --hover: #151518;
  --accent: #9d97ff;
  --gold: #d9ad3f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-underline-position: from-font;
}
a { color: inherit; text-decoration-thickness: from-font; }
h1, h2, p, ol { margin: 0; }
ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.bar, main, .foot { width: min(var(--w), 100% - 40px); margin-inline: auto; }

/* the bar: IMD's own mark at the left, the day and night switch at the right */
.bar { display: flex; align-items: center; justify-content: space-between; padding-block: 20px; }
.pill { display: flex; align-items: stretch; height: 30px; border: var(--rule); text-decoration: none; }
.pill-mark, .pill-brand { display: flex; align-items: center; font: 700 14px/1 var(--mono); }
.pill-mark { width: 28.5px; justify-content: center; border-right: var(--rule); }
.pill-brand { padding-inline: 9px; letter-spacing: 0.04em; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; margin-right: -12px; border: 0; background: none; cursor: pointer; border-radius: 22px; }
.icon-btn:active { transform: scale(0.97); }

.intro { padding-block: 40px 28px; }
h1 { font-size: clamp(34px, 4.4vw, 48px); font-weight: 700; line-height: 1.08; letter-spacing: -0.035em; text-wrap: balance; max-width: 15em; }
.lede { margin-top: 12px; font-size: 16px; color: var(--ink-2); max-width: 44em; text-wrap: pretty; }

/* search, then the categories to browse */
.tools { display: grid; gap: 14px; }
.search { display: flex; align-items: center; gap: 10px; height: 44px; padding-inline: 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink-2); max-width: 420px; }
.search:focus-within { border-color: var(--ink); color: var(--ink); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--ink); font: 400 16px/1 var(--sans); }
.search input::placeholder { color: var(--ink-2); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { height: 32px; padding-inline: 12px; border: 1px solid var(--line); border-radius: 16px; background: none; font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.tag span { color: var(--ink-2); font-weight: 400; margin-left: 5px; font-variant-numeric: tabular-nums; }
.tag:hover { border-color: var(--ink-2); }
.tag[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.tag[aria-pressed="true"] span { color: inherit; opacity: 0.7; }
.tag:active { transform: scale(0.97); }

.listhead { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-top: 28px; padding-bottom: 10px; border-bottom: 1px solid var(--ink); }
.count { font-weight: 700; font-size: 14px; }
.scorenote { color: var(--ink-2); font-size: 14px; white-space: nowrap; }

/* the board: one plugin a row */
.row { display: grid; grid-template-columns: 44px 40px minmax(0, 1fr) 190px 76px 56px; align-items: center; column-gap: 14px; min-height: 68px; padding-block: 12px; border-bottom: 1px solid var(--line); }
.rank { font-size: 16px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.row.top .rank { color: var(--ink); font-weight: 700; }
.row.win .rank { color: var(--gold); }
.face { width: 40px; height: 40px; border-radius: 50%; background: var(--hover); object-fit: cover; display: block; }
.who { min-width: 0; }
.name { font-size: 16px; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.name:hover { text-decoration: underline; }
.by { color: var(--ink-2); margin-left: 8px; font-size: 14px; }
.does { color: var(--ink-2); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; }
.rtags { color: var(--ink-2); font-size: 14px; line-height: 1.4; }
.rtags button { border: 0; padding: 0; background: none; color: inherit; cursor: pointer; text-align: left; }
.rtags button:hover { color: var(--ink); text-decoration: underline; }
.links { display: grid; grid-template-columns: 36px 36px; justify-content: end; gap: 2px; }
.links a { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 18px; color: var(--ink-2); }
.links a:hover { color: var(--ink); background: var(--hover); }
.score { text-align: right; font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; }
.divide { padding: 26px 0 8px; font-size: 14px; font-weight: 700; border-bottom: 1px solid var(--line); }
.divide:first-child { padding-top: 14px; }
.skel { height: 68px; border-bottom: 1px solid var(--line); }

.after { padding-block: 24px 8px; min-height: 76px; }
.btn { height: 44px; padding-inline: 18px; border: 1px solid var(--ink); border-radius: 12px; background: none; font-size: 14px; font-weight: 500; cursor: pointer; }
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(0.97); }
.btn.solid { background: var(--ink); color: var(--bg); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.empty { color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }

.how { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line); max-width: 46em; }
h2 { font-size: 20px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.steps { margin-top: 14px; display: grid; gap: 8px; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 24px 1fr; }
.steps li::before { content: counter(s); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.steps b { font-weight: 700; }
.fine { margin-top: 14px; color: var(--ink-2); text-wrap: pretty; }
.links-row, .how .links { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 14px; justify-content: flex-start; }
.foot { padding-block: 36px 56px; color: var(--ink-2); max-width: min(var(--w), 100% - 40px); }
.foot p { max-width: 46em; text-wrap: pretty; }

/* the scorecard: the row drawn large, in a sheet over the board */
.sheet { width: min(720px, 100% - 24px); max-height: min(88dvh, 900px); padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--bg); color: var(--ink); overflow: hidden; }
.sheet::backdrop { background: rgb(0 0 0 / 0.4); }
.sheet[open] { animation: rise 220ms var(--ease); }
.sheet[open]::backdrop { animation: fade 220ms var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes fade { from { opacity: 0; } }
.sheet-in { max-height: min(88dvh, 900px); overflow-y: auto; padding: 24px 28px 32px; overscroll-behavior: contain; }
.sheet-top { display: flex; align-items: flex-start; gap: 14px; }
.sheet-top .face { width: 48px; height: 48px; flex: none; }
.sheet-title { flex: 1; min-width: 0; }
.sheet-title h2 { overflow-wrap: anywhere; }
.sheet-title h2:focus { outline: 0; }
.sheet-title p { color: var(--ink-2); }
.close { flex: none; margin: -8px -12px 0 0; }
.standing { display: flex; gap: 28px; margin-top: 20px; padding-block: 16px; border-block: 1px solid var(--line); }
.standing div { display: grid; }
.standing b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.standing span { color: var(--ink-2); }
.sheet .does { -webkit-line-clamp: unset; display: block; color: var(--ink); font-size: 16px; margin-top: 18px; text-wrap: pretty; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.acts .btn { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.sheet h3 { margin: 28px 0 0; font-size: 16px; font-weight: 700; }
.bars { margin-top: 10px; display: grid; gap: 8px; }
.barrow { display: grid; grid-template-columns: 132px 1fr 28px; align-items: center; gap: 12px; }
.track { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 9%, transparent); overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 3px; background: var(--ink); }
.barrow b { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.judge { padding-block: 14px; border-bottom: 1px solid var(--line); }
.judge:last-child { border-bottom: 0; }
.judge-top { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.judge-top b { font-weight: 700; }
.judge-top span, .judge-top a { color: var(--ink-2); }
.judge p { margin-top: 6px; text-wrap: pretty; }
.judge p b { font-weight: 700; }
.judge details { margin-top: 8px; color: var(--ink-2); }
.judge summary { cursor: pointer; color: var(--ink); font-weight: 500; }
.judge details p { color: var(--ink-2); }
.why { margin-top: 10px; display: grid; gap: 8px; }
.why p { text-wrap: pretty; }
.sheet .fine { margin-top: 10px; }

@media (max-width: 760px) {
  .intro { padding-block: 20px 22px; }
  .search { max-width: none; }
  .tags { flex-wrap: nowrap; overflow-x: auto; margin-inline: -20px; padding-inline: 20px; scrollbar-width: none; }
  .tag { height: 36px; border-radius: 18px; padding-inline: 14px; }
  .tags::-webkit-scrollbar { display: none; }
  .scorenote a { display: none; }
  .row { grid-template-columns: 30px 36px minmax(0, 1fr) 48px; column-gap: 10px; align-items: start; padding-block: 14px; }
  .face { width: 36px; height: 36px; }
  .rank, .score { line-height: 36px; }
  .by { display: block; margin-left: 0; }
  .does { -webkit-line-clamp: 2; margin-top: 2px; }
  .rtags { display: none; }
  .score { grid-column: 4; grid-row: 1; }
  .links { grid-column: 3 / 5; grid-row: 2; grid-template-columns: 44px 44px; justify-content: start; margin: 2px 0 -8px -13px; }
  .links a { width: 44px; height: 44px; border-radius: 22px; }
  .sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 20px 20px 0 0; border-width: 1px 0 0; max-height: 92dvh; }
  .sheet-in { max-height: 92dvh; padding: 20px 20px 32px; }
  .standing { gap: 22px; }
  .barrow { grid-template-columns: 112px 1fr 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet[open], .sheet[open]::backdrop { animation: fade 150ms linear; }
  .btn:active, .tag:active, .icon-btn:active { transform: none; }
}
