/* ===================================================
   counter-increment を使って擬似要素をリスト化する
   数値は記事・CodePen と同じ。変えたのは色だけ（6 色に）。
   1つずつ、番号のところからコピーして使えます。
   =================================================== */

/* ---------- 共通（マスと番号のまるの見た目。番号の見本にはなくても数字は出ます） ---------- */
.items { grid-template-columns: 1fr; }
.items > li > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 1em;
}
.items > li > div section {
  position: relative;
  width: 18%;
  height: 120px;
  margin: 0 0 30px;
  background: #fff;
  border: 2px solid #e8e3d8;
  box-sizing: border-box;
}
.items > li > div section:before {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 34px;
  height: 34px;
  color: #fff;
  background: #2b2a27;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  z-index: +1;
  display: flex;
  justify-content: center;
  align-items: center;
}
.items > li > div section:nth-child(1):before {
  color: #2b2a27;
  background: #e8dc6a;
}
.items > li > div section:nth-child(2):before {
  background: #6b675f;
}
.items > li > div section:nth-child(4):before {
  color: #2b2a27;
  background: #e8dc6a;
}

/* ---------- 01 「1」からはじまる ---------- */
/*=======
1 2 3 4 5 ...
=======*/
.count_1 section {
  counter-increment: section;
}
.count_1 section:before {
  content: counter(section);
}

/* ---------- 02 「0」からはじまる ---------- */
/*=======
0 1 2 3 4 ...
=======*/
.count_0 section:nth-of-type(1) {
  counter-reset: section;
}
.count_0 section:not(:nth-of-type(1)) {
  counter-increment: section;
}
.count_0 section:before {
  content: counter(section);
}

/* ---------- 03 「01」からはじまる ---------- */
/*=======
01 02 03 04 05 ...
=======*/
.count_01 section {
  counter-increment: section;
}
.count_01 section:before {
  content: counter(section, decimal-leading-zero);
}

/* ---------- 04 「001」からはじまる ---------- */
/*=======
001 002 003 004 005 ...
=======*/
.count_001 section {
  counter-increment: section;
}
.count_001 section:before {
  content: '0' counter(section, decimal-leading-zero);
}
.count_001 section:nth-of-type(99) ~ section:before {
  content: counter(section, decimal-leading-zero);
}

/* ---------- 05 いまの書き方：「0」からはじまる（counter-reset: -1） ---------- */
.count_0_now {
  counter-reset: section -1;
}
.count_0_now section {
  counter-increment: section;
}
.count_0_now section:before {
  content: counter(section);
}

/* ---------- 06 いまの書き方：「001」からはじまる（@counter-style の pad） ---------- */
@counter-style pad3 {
  system: extends decimal;
  pad: 3 "0";
}
.count_001_now section {
  counter-increment: section;
}
.count_001_now section:before {
  content: counter(section, pad3);
}
