@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-400.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-500.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --paper: #f6f6f0;
  --ink: #1d1f1c;
  --muted: #696c63;
  --rule: #d3d4c8;
  --code-bg: #ecece3;
  --accent: #1f4e8c;
  --tok-com: #7b7e73;
  --tok-str: #4d6b3a;
  --tok-num: #8a5a1c;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  --col: 5.5rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #171816;
    --ink: #e3e3da;
    --muted: #9a9c91;
    --rule: #35372f;
    --code-bg: #20221e;
    --accent: #8fb5ec;
    --tok-com: #86897d;
    --tok-str: #a9c690;
    --tok-num: #dcb37a;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171816;
  --ink: #e3e3da;
  --muted: #9a9c91;
  --rule: #35372f;
  --code-bg: #20221e;
  --accent: #8fb5ec;
  --tok-com: #86897d;
  --tok-str: #a9c690;
  --tok-num: #dcb37a;
}

@view-transition {
  navigation: auto;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 1.5rem 1rem 4rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.85;
}

.wrap {
  max-width: 60rem;
  margin: 0 auto;
}

a {
  color: inherit;
}

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

img {
  max-width: 100%;
}

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

.site-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--ink);
}

.site-name {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.theme {
  padding: 0.2rem 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  cursor: pointer;
}

.theme:hover {
  color: var(--ink);
}

.year {
  margin-top: 3rem;
}

.year-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 400;
}

.year-head span:first-child {
  color: var(--ink);
  font-weight: 500;
}

.ledger {
  max-width: 46rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ledger li {
  display: grid;
  grid-template-columns: var(--col) minmax(0, 1fr);
}

.ledger time {
  padding: 0.65rem 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.85rem;
}

.ledger a {
  position: relative;
  display: block;
  padding: 0.65rem 0 0.65rem 1.1rem;
  border-left: 1px solid var(--rule);
  text-decoration: none;
}

.ledger a span {
  background: linear-gradient(var(--accent), var(--accent)) no-repeat 0 100% / 0 1px;
  transition: background-size 0.25s ease;
}

.ledger a:hover span,
.ledger a:focus-visible span {
  background-size: 100% 1px;
}

.ledger a::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 1px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 0.2s ease;
}

.ledger a:hover::before,
.ledger a:focus-visible::before {
  transform: scaleY(1);
}

.empty {
  margin-top: 3rem;
  color: var(--muted);
}

.post {
  display: grid;
  grid-template-columns: var(--col) minmax(0, 40rem) minmax(0, 1fr);
  margin-top: 3rem;
}

.post-meta {
  margin: 0;
  padding-top: 0.55rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.post-meta span {
  display: block;
}

.post-meta .md {
  color: var(--ink);
  font-size: 0.95rem;
}

.post-body {
  min-width: 0;
  padding-left: 1.1rem;
  border-left: 1px solid var(--rule);
}

.post-body h1 {
  margin: 0 0 2rem;
  font-size: 1.7rem;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.post-body h2 {
  position: relative;
  margin: 2.8rem 0 0.8rem;
  font-size: 1.15rem;
  line-height: 1.5;
  scroll-margin-top: 1.5rem;
}

.post-body h2::before {
  content: "";
  position: absolute;
  top: 0.15em;
  bottom: 0.15em;
  left: calc(-1.1rem - 1px);
  width: 3px;
  background: var(--accent);
}

.post-body h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1rem;
}

.post-body p {
  margin: 0 0 1.2rem;
}

.post-body a {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

.post-body a:hover {
  color: var(--accent);
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.2rem;
  padding-left: 1.4rem;
}

.post-body li::marker {
  color: var(--muted);
}

.post-body code {
  padding: 0.1em 0.35em;
  border-radius: 2px;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 0.86em;
}

.post-body pre {
  overflow-x: auto;
  margin: 0 0 1.4rem;
  padding: 0.9rem 1rem;
  border-radius: 2px;
  background: var(--code-bg);
  line-height: 1.6;
  tab-size: 4;
}

.post-body pre code {
  padding: 0;
  background: none;
  font-size: 0.82rem;
}

.post-body blockquote {
  margin: 0 0 1.2rem;
  padding-left: 1rem;
  border-left: 1px solid var(--ink);
  color: var(--muted);
}

.post-body hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.post-body table {
  display: block;
  overflow-x: auto;
  margin: 0 0 1.4rem;
  border-collapse: collapse;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.post-body th,
.post-body td {
  padding: 0.4rem 0.8rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.post-body th {
  border-bottom-color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.post-body [align="center"] {
  text-align: center;
}

.post-body [align="right"] {
  text-align: right;
}

.post-body del {
  color: var(--muted);
}

.post-body li:has(> input[type="checkbox"]) {
  list-style: none;
}

.post-body li > input[type="checkbox"] {
  margin: 0 0.45rem 0 -1.3rem;
  accent-color: var(--accent);
}

.post-body .footnote-ref {
  font-family: var(--mono);
  text-decoration: none;
}

.post-body .footnotes {
  color: var(--muted);
  font-size: 0.88rem;
}

.post-body .footnotes p {
  margin-bottom: 0.5rem;
}

.post-body .footnotes li {
  scroll-margin-top: 1.5rem;
}

.post-body .footnote-backref {
  font-family: var(--mono);
  text-decoration: none;
}

.post-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem;
  margin: 3rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
}

.post-body .post-nav a {
  display: block;
  background: none;
  text-decoration: none;
}

.post-nav .newer {
  grid-column: 2;
  text-align: right;
}

.post-nav .dir {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.post-nav .ttl {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.92rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.post-nav a:hover .ttl,
.post-nav a:focus-visible .ttl {
  color: var(--accent);
}

.post-body .back {
  margin: 2.5rem 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.post-body .back a {
  text-decoration: none;
}

.chroma .k,
.chroma .kc,
.chroma .kd,
.chroma .kn,
.chroma .kp,
.chroma .kr,
.chroma .kt,
.chroma .nt {
  color: var(--accent);
}

.chroma .s,
.chroma .sa,
.chroma .sb,
.chroma .sc,
.chroma .dl,
.chroma .sd,
.chroma .s2,
.chroma .se,
.chroma .sh,
.chroma .si,
.chroma .sx,
.chroma .sr,
.chroma .s1,
.chroma .ss {
  color: var(--tok-str);
}

.chroma .m,
.chroma .mb,
.chroma .mf,
.chroma .mh,
.chroma .mi,
.chroma .il,
.chroma .mo {
  color: var(--tok-num);
}

.chroma .c,
.chroma .ch,
.chroma .cm,
.chroma .c1,
.chroma .cs,
.chroma .cp,
.chroma .cpf {
  color: var(--tok-com);
  font-style: italic;
}

.toc,
.toc-fold {
  font-size: 0.8rem;
  line-height: 1.6;
}

.toc ol,
.toc-fold ol {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc a,
.toc-fold a {
  display: block;
  padding-left: 0.7rem;
  border-left: 1px solid var(--rule);
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}

.toc a:hover,
.toc-fold a:hover {
  color: var(--ink);
}

.toc a[aria-current="true"] {
  border-left-color: var(--accent);
  color: var(--ink);
}

.toc {
  padding-left: 2.5rem;
}

.toc-inner {
  position: sticky;
  top: 1.5rem;
}

.toc p,
.toc-fold summary {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.toc p {
  margin: 0.5rem 0 0.6rem;
}

.toc-fold {
  display: none;
  margin: 0 0 2rem;
}

.toc-fold summary {
  cursor: pointer;
}

.toc-fold ol {
  margin-top: 0.6rem;
}

@media (max-width: 56rem) {
  .post {
    grid-template-columns: var(--col) minmax(0, 1fr);
  }

  .toc {
    display: none;
  }

  .toc-fold {
    display: block;
  }
}

@media (max-width: 30rem) {
  :root {
    --col: 3.6rem;
  }

  .ledger time,
  .post-meta .md {
    font-size: 0.78rem;
  }

  .post-body h1 {
    font-size: 1.4rem;
  }

  .post-nav {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .post-nav .newer {
    grid-column: 1;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }

  @view-transition {
    navigation: none;
  }
}
