:root {
  color-scheme: light;
  --background: #fdfdfc;
  --text: #2b2a27;
  --strong: #0b0b0a;
  --muted: #77746d;
  --border: #e6e3dc;
  --code-background: #f3f1ec;
  --spoiler-background: #d4d1ca;
  --syntax-comment: #77746d;
  --syntax-keyword: #715489;
  --syntax-string: #795a2e;
  --syntax-type: #3e6087;
  --syntax-number: #86514c;
  --syntax-punctuation: #6b6862;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #121212;
  --text: #dcdbd6;
  --strong: #ffffff;
  --muted: #97948d;
  --border: #2c2c2b;
  --code-background: #1c1c1b;
  --spoiler-background: #3b3a38;
  --syntax-comment: #8f8c85;
  --syntax-keyword: #c3b1e1;
  --syntax-string: #d8bd91;
  --syntax-type: #a8c7e8;
  --syntax-number: #d9aaa4;
  --syntax-punctuation: #a9a6a0;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--background);
  color: var(--text);
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

body {
  max-width: 36rem;
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  line-height: 1.7;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--strong);
}

a:focus-visible,
button:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 3px;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 3.5rem;
}

.site-name {
  color: var(--strong);
  font-weight: 600;
  line-height: 26px;
}

.reel {
  position: relative;
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}

.reel::after {
  content: attr(data-reel);
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  color: var(--strong);
  text-align: center;
  visibility: hidden;
  white-space: pre;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .site-name:hover .reel {
    animation: reel-hide 350ms backwards;
  }

  .site-name:hover .reel::after {
    animation: reel-roll 350ms linear backwards;
  }

  .site-name:hover .reel:nth-of-type(2),
  .site-name:hover .reel:nth-of-type(2)::after {
    animation-delay: 90ms;
  }

  .site-name:hover .reel:nth-of-type(3),
  .site-name:hover .reel:nth-of-type(3)::after {
    animation-delay: 180ms;
  }
}

@keyframes reel-hide {
  from,
  to {
    color: transparent;
  }
}

@keyframes reel-roll {
  from {
    top: 0;
    visibility: visible;
  }

  to {
    top: -7lh;
    visibility: visible;
  }
}

.primary-navigation {
  display: flex;
  gap: 1.25rem;
  color: var(--muted);
}

.primary-navigation [aria-current] {
  color: var(--strong);
}

h1,
h2,
h3,
h4 {
  margin: 2.25rem 0 0.6rem;
  color: var(--strong);
  font-size: 1.07rem;
  font-weight: 600;
  line-height: 1.4;
}

p,
ul,
ol,
blockquote,
pre,
table,
.code-block {
  margin: 0 0 1.2rem;
}

ul,
ol {
  padding-left: 1.4rem;
}

li + li {
  margin-top: 0.3rem;
}

:is(.post, .about-content) a {
  color: var(--strong);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

:is(.post, .about-content) a:hover {
  text-decoration-color: currentColor;
}

.home-section > h2 {
  margin-top: 0;
}

.home-section + .home-section {
  margin-top: 2.75rem;
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  margin: 0;
  padding: 0.3rem 0;
}

.post-list a {
  color: var(--strong);
}

.post-list a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.post-list time,
.meta {
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.post-heading {
  margin-bottom: 2rem;
}

.post-heading h1 {
  margin: 0 0 0.2rem;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.post-heading .meta {
  margin: 0;
}

blockquote {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
  color: var(--muted);
}

blockquote > :last-child {
  margin-bottom: 0;
}

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

main img {
  max-width: 100%;
  height: auto;
}

main table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

th,
td {
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  text-align: left;
}

code,
pre,
kbd,
samp {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.85em;
}

:not(pre) > code {
  padding: 0.1em 0.3em;
  border-radius: 3px;
  background: var(--code-background);
}

pre {
  padding: 1rem 1.1rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--code-background);
  line-height: 1.6;
  tab-size: 2;
}

pre code {
  font-size: inherit;
}

.code-block {
  padding: 0.6rem 1.1rem 1rem;
  background: var(--code-background);
}

.code-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.75rem;
}

.code-block pre {
  margin: 0;
  padding: 0;
  background: none;
}

.code-copy,
.site-footer button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.code-copy:hover,
.code-copy[data-state="copied"] {
  color: var(--strong);
}

pre code :is(.c, .ch, .cm, .cp, .cpf, .c1, .cs) {
  color: var(--syntax-comment);
  font-style: italic;
}

pre code :is(.k, .kd, .kn, .kp, .kr, .ow) {
  color: var(--syntax-keyword);
}

pre code :is(.s, .sa, .sb, .sc, .dl, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss) {
  color: var(--syntax-string);
}

pre code :is(.nc, .kt, .nf, .fm) {
  color: var(--syntax-type);
}

pre code :is(.p, .pm, .o) {
  color: var(--syntax-punctuation);
}

pre code :is(.m, .mb, .mf, .mh, .mi, .il, .mo, .kc, .no) {
  color: var(--syntax-number);
}

.spoiler[data-revealed] {
  background: var(--spoiler-background);
}

.spoiler[data-revealed="false"] > .spoiler-content {
  visibility: hidden;
}

.spoiler[data-revealed="true"] {
  background: transparent;
}

.spoiler:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 2px;
}

.back-link {
  margin: 3rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-top: 4rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer a:hover,
.site-footer button:hover {
  color: var(--strong);
}

.skip-link {
  position: absolute;
  top: -4rem;
  padding: 0.5rem;
  background: var(--background);
}

.skip-link:focus {
  top: 0.5rem;
}

@media (max-width: 32rem) {
  body {
    padding: 2.5rem 1.25rem 2rem;
  }

  .site-header {
    margin-bottom: 2.5rem;
  }
}

@media print {
  :root,
  :root[data-theme="dark"] {
    color-scheme: light;
    --background: #fff;
    --text: #000;
    --strong: #000;
    --muted: #444;
    --border: #bbb;
    --code-background: #f5f5f5;
  }

  body {
    max-width: none;
    padding: 0;
  }

  .site-header,
  .site-footer,
  .skip-link,
  .code-copy,
  .back-link {
    display: none;
  }

  pre code span {
    color: inherit !important;
  }

  .spoiler[data-revealed] {
    background: transparent;
  }

  .spoiler > .spoiler-content {
    visibility: visible !important;
  }
}
