@font-face {
  font-family: "Computer Modern Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/CMUSansSerif.woff2") format("woff2");
}

@font-face {
  font-family: "Computer Modern Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/CMUSansSerif-Bold.woff2") format("woff2");
}

@font-face {
  font-family: "Computer Modern Sans";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/CMUSansSerif-Oblique.woff2") format("woff2");
}

@font-face {
  font-family: "Computer Modern Sans";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/CMUSansSerif-BoldOblique.woff2") format("woff2");
}

:root {
  --font-family: "Computer Modern Sans", Arial, sans-serif;
  --gap: 24px;
  --content-gap: 20px;
  --nav-width: 1024px;
  --main-width: 720px;
  --post-width: 840px;
  --header-height: 60px;
  --radius: 8px;
  --theme: #fcefe1;
  --entry: #fff5eb;
  --primary: #000;
  --secondary: #29211b;
  --border: rgba(0, 0, 0, 0.18);
  --soft-border: rgba(0, 0, 0, 0.1);
}

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

html {
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--primary);
  background: var(--theme);
  font-family: var(--font-family);
  font-size: 18px;
  line-height: 1.6;
  word-break: break-word;
}

.blog-page {
  background: var(--entry);
}

a {
  color: var(--primary);
  text-decoration: none;
}

p,
h1,
h2,
h3 {
  margin: 0;
}

code {
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.08);
  font-size: 0.9em;
}

.site-header {
  min-height: calc(var(--header-height) + 34px);
}

.nav {
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: calc(var(--nav-width) + var(--gap) * 2);
  min-height: calc(var(--header-height) + 34px);
  margin: 0 auto;
  padding: 12px var(--gap) 10px;
}

.header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.logo {
  display: block;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

.social-icons {
  display: flex;
  align-items: center;
  gap: 14px;
}

.social-icons a {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--primary);
  opacity: 0.82;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.social-icons a:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.social-icons svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.favorite-link {
  opacity: 1;
}

.star-icon {
  display: block;
  width: 21px;
  height: 21px;
  background: #c99700;
  mask: url("assets/star.png") center / contain no-repeat;
  -webkit-mask: url("assets/star.png") center / contain no-repeat;
}

.corner-gifs {
  position: fixed;
  left: 18px;
  bottom: 18px;
  display: flex;
  gap: 6px;
  align-items: flex-end;
  pointer-events: none;
}

.corner-gifs img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.post-content a:hover {
  box-shadow: 0 1px 0 var(--primary);
}

.main {
  position: relative;
  max-width: calc(var(--main-width) + var(--gap) * 2);
  min-height: calc(100vh - var(--header-height));
  margin: 0 auto;
  padding: var(--gap);
}

.blog-page .main {
  max-width: calc(var(--post-width) + var(--gap) * 2);
}

.intro {
  display: flex;
  min-height: auto;
  flex-direction: column;
  justify-content: flex-start;
  margin: 42px 0 30px;
}

.intro p {
  max-width: 58ch;
  color: var(--secondary);
  font-size: 16px;
}

.post-entry {
  position: relative;
  margin-bottom: var(--gap);
  padding: var(--gap);
  background: var(--entry);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.1s ease, background 0.1s ease;
}

.post-entry:hover {
  background: rgba(255, 255, 255, 0.14);
}

.post-entry:active {
  transform: scale(0.98);
}

.entry-header h2 {
  font-size: 24px;
  line-height: 1.3;
}

.entry-content {
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 0;
  color: var(--secondary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.entry-footer {
  color: var(--secondary);
  font-size: 13px;
}

.entry-link {
  position: absolute;
  inset: 0;
}

.post-header {
  margin: 24px auto var(--content-gap);
}

.post-nav {
  margin: 6px 0 30px;
  font-size: 14px;
}

.post-nav a {
  color: var(--secondary);
}

.post-nav a:hover {
  color: var(--primary);
  box-shadow: 0 1px 0 var(--primary);
}

.post-title {
  margin-bottom: 2px;
  font-size: 40px;
  line-height: 1.2;
}

.post-deck {
  max-width: 62ch;
  margin: 10px 0 14px;
  color: var(--secondary);
  font-size: 19px;
  line-height: 1.5;
}

.post-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 28px;
}

.post-links a {
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: none;
  font-size: 14px;
  font-weight: 500;
}

.post-links a:hover {
  border-color: var(--primary);
  box-shadow: none;
}

.post-meta {
  color: var(--secondary);
  font-size: 14px;
}

.post-content {
  color: var(--primary);
}

.post-content p,
.post-content ul,
.post-content ol {
  margin-bottom: var(--content-gap);
}

.post-content h2 {
  margin: 32px 0 16px;
  font-size: 28px;
  line-height: 1.25;
}

.post-content h3 {
  margin: 26px 0 12px;
  font-size: 22px;
  line-height: 1.3;
}

.post-content h4 {
  margin: 22px 0 10px;
  font-size: 19px;
  line-height: 1.35;
}

.post-content img {
  display: block;
  width: 100%;
  height: auto;
  margin: 30px auto 8px;
  border: 1px solid var(--soft-border);
  border-radius: var(--radius);
  background: #fff;
}

.post-content img + em,
.post-content p > em:only-child {
  display: block;
  color: var(--secondary);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.post-content .figure-caption {
  display: block;
  color: var(--secondary);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.post-content .figure-caption em {
  display: inline;
}

.post-content .figure-caption sup {
  margin-left: 1px;
}

.post-content .disclaimer {
  margin: 26px 0;
  padding: 14px 16px;
  border-left: 3px solid var(--primary);
  background: rgba(0, 0, 0, 0.04);
  font-size: 15px;
}

.post-content .correctness-table {
  margin: 28px 0 32px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}

.post-content .correctness-table table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.post-content .correctness-table caption {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.025);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}

.post-content .correctness-table th,
.post-content .correctness-table td {
  padding: 8px 10px;
  border-right: 1px solid var(--soft-border);
  border-bottom: 1px solid var(--soft-border);
  text-align: right;
  white-space: nowrap;
}

.post-content .correctness-table th {
  background: rgba(0, 0, 0, 0.045);
  font-weight: 600;
  text-align: center;
  vertical-align: middle;
}

.post-content .correctness-table thead tr:first-child th {
  border-bottom-color: var(--border);
}

.post-content .correctness-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.018);
}

.post-content .correctness-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.05);
}

.post-content .correctness-table tr > :last-child {
  border-right: 0;
}

.post-content .correctness-table tbody tr:last-child td {
  border-bottom: 0;
}

.post-content .footnotes {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--secondary);
  font-size: 13px;
}

.post-content .footnotes::before {
  content: "Notes";
  display: block;
  margin-bottom: 10px;
  color: var(--primary);
  font-size: 18px;
  font-weight: 600;
}

.post-content mjx-container[display="true"] {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 0;
}

.post-content a {
  box-shadow: 0 1px 0 var(--primary);
}

.post-content blockquote {
  margin: 20px 0;
  padding-left: 14px;
  border-left: 3px solid var(--primary);
  color: var(--secondary);
}

.post-content hr {
  height: 1px;
  margin: 30px 0;
  border: 0;
  background: var(--border);
}

.post-content ul,
.post-content ol {
  padding-left: 22px;
}

.post-content li {
  margin-top: 5px;
}

.top-link {
  position: fixed;
  right: 30px;
  bottom: 30px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--theme);
  color: var(--primary);
  font-size: 18px;
}

@media (max-width: 768px) {
  :root {
    --gap: 16px;
  }

  body {
    font-size: 17px;
  }

  .intro {
    margin: 30px 0 24px;
  }

  .post-title {
    font-size: 34px;
  }

  .post-deck {
    font-size: 17px;
  }

  .top-link {
    right: 16px;
    bottom: 16px;
  }
}
