/* b0y0.com 共通スタイル */

:root {
  --paper: #f8f8f8;
  --ink: #000;
  --muted: #555;
  --rule: #000;
  --soft: #d4d4d4;
  --tint: #ececec;
  --serif: Georgia, "Times New Roman", "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", YuMincho, "Noto Serif JP", "Noto Serif CJK JP", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --measure: 38rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #222;
    --ink: #fff;
    --muted: #bbb;
    --rule: #fff;
    --soft: #4a4a4a;
    --tint: #2f2f2f;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.95;
  line-break: strict;
  overflow-wrap: break-word;
}

@media (max-width: 30rem) {
  body { font-size: 1rem; }
}

/* ---------- 骨組み ---------- */

.wrap {
  max-width: calc(var(--measure) + 40px);
  margin: 0 auto;
  padding: 0 20px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 16px;
  top: 16px;
  z-index: 10;
  background: var(--paper);
  border: 2px solid var(--rule);
  padding: .4em .8em;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  padding-top: 24px;
}

.brand {
  display: inline-block;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  color: inherit;
  text-decoration: none;
  border: 2px solid var(--rule);
  padding: .45em .6em;
}
.brand:hover {
  background: var(--ink);
  color: var(--paper);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  font-size: .95rem;
}
.site-nav a[aria-current="page"] { text-decoration-thickness: 2px; }

main.wrap { padding-top: 48px; }

.site-footer {
  margin-top: 5rem;
  padding-bottom: 3rem;
  font-size: .92rem;
  line-height: 1.8;
  color: var(--muted);
}
.site-footer::before {
  content: "";
  display: block;
  border-top: 2px solid var(--rule);
  margin-bottom: 1.3rem;
}
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
}
.site-footer nav + nav { margin-top: .4rem; }
.site-footer a { color: var(--ink); }
.site-footer p { margin: .6rem 0 0; }

/* ---------- 文字 ---------- */

h1, h2, h3 {
  margin: 0;
  font-weight: 700;
  line-height: 1.5;
  word-break: auto-phrase;
}
h1 {
  font-size: clamp(1.55rem, 1.1rem + 1.7vw, 2.1rem);
  letter-spacing: .02em;
}
h2 {
  font-size: 1.38rem;
  margin-top: 3.4rem;
}
h3 {
  font-size: 1.12rem;
  margin-top: 2.2rem;
}

p, ul, ol, dl, .note, .table-wrap { margin: 1rem 0 0; }

ul, ol { padding-left: 1.5em; }
li + li { margin-top: .4em; }

.lead { font-size: 1.12rem; margin-top: 1.3rem; }
.meta { color: var(--muted); font-size: .9rem; margin-top: .8rem; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
}
a:hover { text-decoration-thickness: 2px; }

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

code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--tint);
  padding: .1em .35em;
  word-break: break-all;
}

/* ---------- 部品 ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 22px;
  margin-top: 1.4rem;
}

.button {
  display: inline-block;
  font-weight: 700;
  line-height: 1.4;
  color: inherit;
  text-decoration: none;
  border: 2px solid var(--rule);
  padding: .6em 1.1em;
}
.button:hover {
  background: var(--ink);
  color: var(--paper);
}

.toc {
  margin-top: 2.2rem;
  border: 1px solid var(--rule);
  padding: .9rem 1.25rem 1rem;
}
.toc-title { margin: 0; font-weight: 700; }
.toc ol { margin-top: .3rem; }
.toc li + li { margin-top: .15em; }

.note {
  border: 1px solid var(--rule);
  padding: .9rem 1.2rem;
}
.note > :first-child { margin-top: 0; }

.facts { padding: 0; }
.facts div {
  display: grid;
  grid-template-columns: 9em 1fr;
  gap: 0 1rem;
  padding: .3rem 0;
  border-bottom: 1px solid var(--soft);
}
.facts dt { font-weight: 700; }
.facts dd { margin: 0; }

.person {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 1.2rem;
}

/* 項目の並び（アプリ、記事） */
.entries {
  list-style: none;
  padding: 0;
  margin-top: 1.4rem;
}
.entries > li {
  margin-top: 1.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--soft);
}
.entries > li:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.entries h3 {
  margin-top: 0;
  font-size: 1.12rem;
}
.entry-date {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}
.entries .actions { margin-top: 1rem; }

/* 順に進める手順 */
.steps li + li { margin-top: .7em; }

/* 日付の並び */
.timeline {
  list-style: none;
  padding: 0;
}
.timeline li {
  display: grid;
  grid-template-columns: 9.5em 1fr;
  gap: 0 1rem;
  margin: 0;
  padding: .55rem 0;
  border-bottom: 1px solid var(--soft);
}
.timeline time { font-weight: 700; }

@media (max-width: 30rem) {
  .facts div,
  .timeline li { grid-template-columns: 1fr; }
}

/* 表 */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
  line-height: 1.75;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: .55rem .9rem .55rem 0;
  border-bottom: 1px solid var(--soft);
}
th:last-child, td:last-child { padding-right: 0; }
thead th {
  border-bottom: 2px solid var(--rule);
  white-space: nowrap;
}
tbody th { min-width: 7em; }

/* 列の多い表は、狭い画面では行ごとに縦に並べる */
@media (max-width: 40rem) {
  .table-stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .table-stack,
  .table-stack tbody,
  .table-stack tr,
  .table-stack th,
  .table-stack td {
    display: block;
    width: 100%;
  }
  .table-stack tr {
    padding: .7rem 0;
    border-bottom: 1px solid var(--soft);
  }
  .table-stack th,
  .table-stack td {
    min-width: 0;
    padding: .1rem 0;
    border: 0;
  }
  .table-stack td::before {
    content: attr(data-label) "：";
    font-weight: 700;
  }
}

/* ---------- トップページの見出し部 ---------- */

.hero {
  position: relative;
  overflow: hidden;
  min-height: 36vh;
  min-height: 36svh;
  display: grid;
  place-content: center;
  padding: 48px 20px;
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.hero .name {
  display: inline-block;
  margin: 0;
  font-size: clamp(2.2rem, 9vw, 3rem);
  line-height: 1.2;
  letter-spacing: 0;
  border: 2px solid var(--rule);
  padding: 20px;
}
.hero .links { margin-top: 20px; }
.hero .links a {
  display: inline-block;
  margin: 0 15px;
  font-size: 1.2rem;
  line-height: 1.6;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.hero .links a:hover { border-bottom-width: 2px; }

.ripple {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  transform: scale(0);
  animation: ripple 1.5s ease-out forwards;
  pointer-events: none;
}
@keyframes ripple {
  to {
    transform: scale(15);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ripple { display: none; }
}

/* ---------- 記事 ---------- */

pre {
  margin: 1rem 0 0;
  padding: .9rem 1.1rem;
  background: var(--tint);
  overflow-x: auto;
  font-size: .88rem;
  line-height: 1.7;
}
pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  word-break: normal;
  white-space: pre;
}

figure { margin: 1.6rem 0 0; }
figure svg {
  display: block;
  width: 100%;
  max-width: 27rem;
  height: auto;
  margin: 0 auto;
}
figcaption {
  margin-top: .6rem;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.75;
}

/* ---------- 運営者の表示 ---------- */

.byline { margin-top: 3rem; font-size: .95rem; line-height: 1.85; }
.byline p + p { margin-top: .3rem; }

/* ---------- トップページ：ノートの並び ---------- */

.hero .tagline {
  margin: 18px auto 0;
  max-width: 26em;
  font-size: 1.05rem;
  line-height: 1.7;
}

.note-group { margin-top: 1.8rem; font-size: 1.05rem; }
.note-list {
  list-style: none;
  padding: 0;
  margin-top: .6rem;
}
.note-list li { margin-top: 1.1rem; }
.note-list li:first-child { margin-top: 0; }
.note-list a { font-weight: 700; }
.note-list p {
  margin: .2rem 0 0;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.75;
}

.hero .tagline span { display: inline-block; }
.hero + main.wrap { padding-top: 8px; }
.hero + main > section:first-child > h2:first-child { margin-top: 1rem; }

/* ---------- 記事の図と写真 ---------- */

figure img.photo {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.chart svg { max-width: 100%; }

.compare {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
}
.compare figure { margin: 0; }
.compare img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}
.compare figcaption {
  margin-top: .25rem;
  font-size: .82rem;
  line-height: 1.5;
}

details.data { margin-top: 1rem; }
details.data summary { cursor: pointer; }

.wrap-head thead th {
  white-space: normal;
  word-break: auto-phrase;
}

/* ---------- スマートフォンの画面写真と地図 ---------- */

figure img.shot {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--soft);
}

/* 2枚を横に並べる */
.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  max-width: 620px;
  margin: 0 auto;
}
.pair figure { margin: 0; }
.pair img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--soft);
}
.pair figcaption {
  margin-top: .35rem;
  font-size: .85rem;
  line-height: 1.55;
}

figure img.map {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

/* 白地に黒の図は、暗い表示では反転して、背景になじませる */
@media (prefers-color-scheme: dark) {
  img.ink { filter: invert(.88); }
}

/* 図の説明の中の短いコードは、数字の途中で折り返さない */
figcaption code { word-break: normal; }
