/* ---------------------------------------------------------
   Pokémon — a one-page field guide
   --------------------------------------------------------- */

:root {
  --ink:   #111418;
  --paper: #fdfcf8;
  --rule:  #111418;
  --soft:  #6d7480;
  --flame: #e03a2f;

  /* the eighteen types */
  --normal:   #a5a58d;
  --fire:     #e2743a;
  --water:    #4d86cf;
  --grass:    #4f9d55;
  --electric: #e0b32c;
  --ice:      #6fc3c0;
  --fighting: #b8382b;
  --poison:   #8b4a97;
  --ground:   #c19a4a;
  --flying:   #7f8ad6;
  --psychic:  #dd5a80;
  --bug:      #849623;
  --rock:     #a8924e;
  --ghost:    #5f5190;
  --dragon:   #5140c6;
  --dark:     #4c3f38;
  --steel:    #8a8aa0;
  --fairy:    #d97ea0;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Work Sans", ui-sans-serif, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

:focus-visible { outline: 3px solid var(--flame); outline-offset: 3px; }

.wrap { max-width: 720px; margin: 0 auto; padding: 0 24px; }

/* --- type colour classes, shared by the wall and the inline chips --- */

.t-normal   { background: var(--normal); }
.t-fire     { background: var(--fire); }
.t-water    { background: var(--water); }
.t-grass    { background: var(--grass); }
.t-electric { background: var(--electric); }
.t-ice      { background: var(--ice); }
.t-fighting { background: var(--fighting); }
.t-poison   { background: var(--poison); }
.t-ground   { background: var(--ground); }
.t-flying   { background: var(--flying); }
.t-psychic  { background: var(--psychic); }
.t-bug      { background: var(--bug); }
.t-rock     { background: var(--rock); }
.t-ghost    { background: var(--ghost); }
.t-dragon   { background: var(--dragon); }
.t-dark     { background: var(--dark); }
.t-steel    { background: var(--steel); }
.t-fairy    { background: var(--fairy); }

/* --- hero --- */

.hero { border-bottom: 2px solid var(--rule); }

.wall {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-bottom: 2px solid var(--rule);
}

.wall span {
  aspect-ratio: 2 / 1;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: clamp(10px, 2vw, 15px);
  letter-spacing: .01em;
  border-right: 2px solid var(--rule);
  border-bottom: 2px solid var(--rule);
}

.wall span:nth-child(6n) { border-right: 0; }
.wall span:nth-child(n+13) { border-bottom: 0; }

@media (max-width: 560px) {
  .wall { grid-template-columns: repeat(3, 1fr); }
  .wall span:nth-child(6n) { border-right: 2px solid var(--rule); }
  .wall span:nth-child(3n) { border-right: 0; }
  .wall span:nth-child(n+13) { border-bottom: 2px solid var(--rule); }
  .wall span:nth-child(n+16) { border-bottom: 0; }
}

.headline { padding: 46px 0 40px; }

h1 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: clamp(38px, 8vw, 64px);
  line-height: .98;
  letter-spacing: -.03em;
  margin: 0 0 18px;
}

.lede { font-size: 19px; max-width: 44ch; margin: 0; color: var(--soft); }

/* --- sections --- */

section { padding: 46px 0; border-bottom: 2px solid var(--rule); }
section:last-of-type { border-bottom: 0; }

h2 {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 27px;
  letter-spacing: -.02em;
  margin: 0 0 14px;
}

p { margin: 0 0 16px; max-width: 68ch; }
p:last-child { margin-bottom: 0; }

.stack-note { margin-top: 22px; }

/* --- stat row --- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 2px solid var(--rule);
  margin-top: 28px;
}

.stats div { padding: 14px 12px 4px; border-right: 1px solid var(--rule); }
.stats div:last-child { border-right: 0; }

.stats b {
  display: block;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -.02em;
}

.stats em { font-style: normal; font-size: 13px; color: var(--soft); }

@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div:nth-child(2n) { border-right: 0; }
  .stats div:nth-child(n+3) { border-top: 1px solid var(--rule); }
}

/* --- inline type chips --- */

.chip {
  display: inline-block;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.35;
  padding: 1px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

/* --- matchup rules --- */

.rules { margin: 22px 0 0; padding: 0; list-style: none; }

.rules li {
  border-left: 6px solid var(--flame);
  padding: 2px 0 2px 16px;
  margin-bottom: 20px;
  max-width: 62ch;
}

.rules li:last-child { margin-bottom: 0; }
.rules strong { font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; }

.rules li:nth-child(1) { border-color: var(--fire); }
.rules li:nth-child(2) { border-color: var(--electric); }
.rules li:nth-child(3) { border-color: var(--ghost); }
.rules li:nth-child(4) { border-color: var(--steel); }

/* --- generations table --- */

table { width: 100%; border-collapse: collapse; margin-top: 24px; }

caption { text-align: left; font-size: 14px; color: var(--soft); padding-bottom: 10px; }

th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--rule); font-size: 16px; }
th { font-weight: 600; font-size: 14px; color: var(--soft); border-bottom-width: 2px; }

tbody td:first-child { font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; width: 54px; }
td:last-child, th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* --- numbered steps --- */

ol.steps { margin: 22px 0 0; padding: 0; list-style: none; counter-reset: s; }

ol.steps li {
  counter-increment: s;
  position: relative;
  padding-left: 46px;
  margin-bottom: 20px;
  max-width: 62ch;
}

ol.steps li:last-child { margin-bottom: 0; }

ol.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 2px;
  width: 30px;
  height: 30px;
  border: 2px solid var(--rule);
  border-radius: 50%;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 15px;
  display: grid;
  place-items: center;
}

ol.steps strong { font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; }

/* --- footer --- */

footer {
  border-top: 2px solid var(--rule);
  padding: 22px 0 48px;
  font-size: 13.5px;
  color: var(--soft);
}

footer p { max-width: 60ch; }
