/* The look is decided here: colour, type and spacing tokens first, then the components that use them. */
:root {
  color-scheme: light dark;

  --paper: #f7f2e9;
  --surface: #fffdf9;
  --ink: #201a16;
  --muted: #5a5048;
  --line: #d9cfc0;
  --accent: #8a2d0f;
  --accent-ink: #fffdf9;
  --focus: #1d4ed8;
  --error-surface: #fbe9e5;
  --error-ink: #7a1c0c;

  --font-display: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --radius: 0.75rem;
  --page-width: 68rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #181412;
    --surface: #221c19;
    --ink: #f4ede3;
    --muted: #c0b4a7;
    --line: #4a403a;
    --accent: #f2a878;
    --accent-ink: #1a120d;
    --focus: #9cc2ff;
    --error-surface: #3b1a14;
    --error-ink: #ffd2c6;
  }
}

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

body {
  margin: 0 auto;
  max-width: var(--page-width);
  padding: var(--space-4) var(--space-3) var(--space-5);
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.55 var(--font-body);
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
.wordmark {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.25rem);
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.125rem;
  margin-top: var(--space-5);
}

p {
  margin: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a[target="_blank"]::after {
  content: " \2197";
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* The results heading takes focus from script after an import, so it needs no ring. */
[tabindex="-1"]:focus {
  outline: none;
}

[hidden] {
  display: none !important;
}

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

.masthead {
  padding: var(--space-4) 0 var(--space-5);
}

.wordmark {
  color: var(--accent);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-3);
}

.lede {
  font-size: 1.125rem;
  margin-top: var(--space-3);
  max-width: 44rem;
}

.start {
  display: grid;
  gap: var(--space-4);
  align-items: start;
}

@media (min-width: 54rem) {
  .start {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
}

.panel > * + * {
  margin-top: var(--space-3);
}

.field {
  display: grid;
  gap: var(--space-2);
}

label {
  font-weight: 600;
}

.hint,
.sample,
.empty {
  color: var(--muted);
  font-size: 0.9375rem;
}

.sample {
  display: grid;
  gap: var(--space-2);
  justify-items: start;
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

input[type="file"],
select {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--muted);
  border-radius: 0.5rem;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

input[type="file"] {
  border-style: dashed;
  padding: var(--space-2);
}

select {
  padding: var(--space-2) var(--space-3);
}

input[type="file"]::file-selector-button {
  margin-right: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: 0.375rem;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button-quiet {
  min-height: 2.75rem;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.progress progress {
  flex: 1 1 10rem;
  height: 0.75rem;
  accent-color: var(--accent);
}

.status:empty,
.error:empty {
  display: none;
}

.status {
  font-weight: 600;
}

.error {
  padding: var(--space-3);
  border-left: 0.25rem solid var(--error-ink);
  border-radius: 0.25rem;
  background: var(--error-surface);
  color: var(--error-ink);
}

.steps {
  margin-bottom: 0;
  padding-left: 1.25rem;
}

.steps li + li {
  margin-top: var(--space-2);
}

.results {
  margin-top: var(--space-4);
}

.summary {
  max-width: 44rem;
}

.tracks {
  counter-reset: rank;
  list-style: none;
  padding: 0;
  margin-bottom: 0;
}

.track {
  counter-increment: rank;
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  column-gap: var(--space-3);
  row-gap: var(--space-1);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--line);
}

.track::before {
  content: counter(rank);
  grid-row: 1 / span 2;
  color: var(--accent);
  font: 700 1.5rem/1.2 var(--font-display);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.track-name,
.track-facts {
  grid-column: 2;
}

.track-title {
  display: block;
  font-size: 1.125rem;
  font-weight: 700;
}

.track-credit {
  color: var(--muted);
}

.track-facts {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--space-4);
  font-variant-numeric: tabular-nums;
}

.track-days {
  font-weight: 600;
}

@media (min-width: 46rem) {
  .track {
    grid-template-columns: 2.5rem minmax(0, 1fr) auto;
    align-items: center;
  }

  .track::before {
    grid-row: 1;
  }

  .track-facts {
    grid-column: 3;
    flex-direction: column;
    text-align: right;
  }
}

.coverage {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: var(--space-3);
  margin-bottom: 0;
}

.coverage dt {
  color: var(--muted);
  font-size: 0.875rem;
}

.coverage dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.coverage-wide {
  grid-column: 1 / -1;
}

.coverage .reasons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: var(--space-1) 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 400;
}

.colophon {
  margin-top: var(--space-4);
  color: var(--muted);
  font-size: 0.9375rem;
}
