/* Tokens, fonts and rules from the design guidelines:
   https://claude.ai/artifact/PAzLdphuhmJcT9wFkNLX6t
   Red is for emphasis only: one word or short phrase, never a fill, never on blue.
   Pale blue is for large fills only, never text. No italics in Cyrillic. */

/* Noto Serif and Noto Sans, variable weight (fontsource 5.3.0, OFL, fonts/OFL.txt).
   Self-hosted, so visitors' browsers don't call Google. Browsers download only
   the subsets a page uses. */
@font-face {
  font-family: "Noto Serif";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/noto-serif-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Noto Serif";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/noto-serif-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Noto Serif";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/noto-serif-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Noto Sans";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/noto-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Noto Sans";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/noto-sans-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Noto Sans";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/noto-sans-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  color-scheme: light;
  --bg: #F3F5F8;
  --ink: #0E1A2B;
  --red: #C6363C;
  --blue: #0C4076;
  --mid: #4A6FA5;
  --pale: #B4C4DC;
  --white: #FFFFFF;
  --muted: #4B5668;
  --rule: #D6DDE7;
  --serif: "Noto Serif", Georgia, "Times New Roman", serif;
  --sans: "Noto Sans", "Segoe UI", Roboto, Arial, sans-serif;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
}

/* Flag order, top to bottom: red above blue. Upside down it's the Russian flag. */
.flagbar {
  display: grid;
  grid-template-rows: 8px 8px;
}
.flagbar span:nth-child(1) {
  background: var(--red);
}
.flagbar span:nth-child(2) {
  background: var(--blue);
}

/* Wide enough for the title on one line at full size. */
main {
  container-type: inline-size;
  max-width: 1400px;
  margin: 0 auto;
  padding: 48px 24px 72px;
}

/* The title is 28.3em wide in Noto Serif Bold, so at 3.45cqi it fills 98% of
   main: one line, down to the 30px minimum (about 920px wide). Below, it wraps. */
h1 {
  margin: 0;
  font: 700 clamp(30px, 3.45cqi, 46px)/1.1 var(--serif);
  text-wrap: balance;
}
h1 em {
  font-style: normal;
  color: var(--red);
}

.intro {
  display: grid;
  gap: 12px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 17px;
}
.intro p {
  margin: 0;
}

.summary {
  margin-top: 40px;
}
.summary h2 {
  margin: 0 0 16px;
  font: 700 24px/1.2 var(--serif);
}
.summary h3 {
  margin: 24px 0 12px;
  font: 700 18px/1.2 var(--serif);
}
/* The costs total, set apart from the three costs it adds up. */
.stat.stat-total {
  background: var(--pale);
  border-color: var(--pale);
  border-top-color: var(--blue);
}
.stat-total .stat-label {
  color: var(--ink);
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.stat {
  padding: 20px 24px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--blue);
}
.stat p {
  margin: 0;
}
.stat-label {
  font: 700 12px/1.2 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
}
/* The sums can grow very long: let them break rather than overflow. */
.stat-number {
  margin-top: 8px;
  font: 700 clamp(32px, 5vw, 48px)/1.1 var(--serif);
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.card {
  display: grid;
  gap: 20px;
  margin-top: 40px;
  padding: 24px;
  background: var(--white);
  border: 1px solid var(--rule);
}
.card p {
  margin: 0;
}
.card h2 {
  margin: 0;
  font: 700 24px/1.2 var(--serif);
}

.field {
  display: grid;
  gap: 6px;
}

label {
  font-weight: 700;
}

/* Borders in mid blue: the rule gray is too faint to see where a field is. */
select,
input {
  font: inherit;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--mid);
  border-radius: 0;
  padding: 10px 12px;
}
/* Wide enough for the digits a field takes. */
.digits-1 {
  width: 4em;
}
.digits-3 {
  width: 6em;
}
.digits-4 {
  width: 7em;
}
.digits-5 {
  width: 8em;
}
.digits-7 {
  width: 10em;
}

.costs {
  margin: 0;
  padding: 16px 20px 20px;
  border: 1px solid var(--rule);
}
.costs legend {
  padding: 0 6px;
  font-weight: 700;
}
.costs-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
}
.hint {
  color: var(--muted);
  font-size: 14px;
}
[aria-invalid="true"] {
  border-color: var(--red);
}

button {
  justify-self: start;
  font: 700 16px/1 var(--sans);
  color: var(--white);
  background: var(--blue);
  border: 0;
  padding: 14px 24px;
  cursor: pointer;
}
button:hover {
  background: var(--mid);
}

.error {
  color: var(--red);
  font-size: 14px;
  font-weight: 600;
}

.thanks {
  font: 700 24px/1.2 var(--serif);
}

a {
  color: var(--blue);
}

.leaderboard {
  margin-top: 40px;
}
.leaderboard-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 16px;
}
.leaderboard-head h2 {
  margin: 0;
  font: 700 24px/1.2 var(--serif);
}
.leaderboard-head form {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ranking {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rank;
  background: var(--white);
  border: 1px solid var(--rule);
}
.ranking li {
  counter-increment: rank;
  display: grid;
  grid-template-columns: 3em 1fr auto;
  align-items: baseline;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--rule);
}
.ranking li:first-child {
  border-top: 0;
}
.ranking li::before {
  content: counter(rank) ".";
  font: 700 14px/1 var(--sans);
  color: var(--mid);
  font-variant-numeric: tabular-nums;
}
.ranking .city {
  font-weight: 600;
}
.ranking .value {
  font: 700 20px/1.2 var(--serif);
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow-wrap: anywhere;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  main {
    padding-inline: 16px;
  }
}
