@font-face {
  font-family: 'Latin-Italic-Only';
  src: local('Palatino Italic'),
       local('Palatino-Italic'),
       local('Palatino Linotype Italic'),
       local('Book Antiqua Italic'),
       local('Times New Roman Italic'),
       local('TimesNewRomanPS-ItalicMT'),
       local('Georgia Italic'),
       local('Georgia-Italic'),
       local('Noto Serif Italic'),
       local('NotoSerif-Italic'),
       local('Droid Serif Italic'),
       local('Liberation Serif Italic'),
       local('Nimbus Roman No9 L Italic'),
       local('DejaVu Serif Italic');
  unicode-range: U+0000-024F;
}

:root {
  --side-width: 240px;
  --side-gap: 28px;
  --font-base: "Georgia", "Nimbus Roman No9 L", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", STSong, SimSun, serif;
  --font-alt: "Latin-Italic-Only", "Kaiti SC", "STKaiti", "KaiTi", "Microsoft KaiTi", "FZKai-Z03", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 8px;
  font-family: var(--font-base);
  line-height: 1.62;
  counter-reset: sidenote-counter;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 calc(var(--side-width) + var(--side-gap)) 0 0;
  position: relative;
}

h1,
h2,
h3 {
  margin: 0.83em 0;
  font-family: var(--font-alt);
  line-height: 1.3;
  text-wrap: pretty;
}

h1 {
  margin-top: 0.67em;
  font-size: 2em;
}

h2 {
  font-size: 1.5em;
}

h3 {
  font-size: 1.17em;
}

p,
ul,
ol,
pre,
blockquote {
  margin: 1.1em 0;
}

p,
ul,
ol,
blockquote {
  text-wrap: pretty;
}

ul,
ol {
  padding-left: 1.25em;
}

a {
  text-underline-offset: 0.08em;
  overflow-wrap: anywhere;
}

a:hover {
  color: #551a8b;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.site-logo:focus-visible,
.margin-toggle-label:focus-visible {
  outline: 2px solid #0000ee;
  outline-offset: 2px;
}

.post-date {
  margin: 0 0 1rem;
  color: #444;
  font-size: 0.95rem;
}

h1 + .post-date {
  margin-top: -0.5rem;
}

.site-logo {
  position: absolute;
  right: calc(var(--side-width) + var(--side-gap));
  color: inherit;
  text-decoration: none;
  opacity: 0.85;
}

.site-logo svg,
.site-logo img {
  max-width: 80px;
  max-height: 80px;
}

em {
  font-family: var(--font-alt);
  font-style: normal;
}

.sidenote-wrapper {
  counter-increment: sidenote-counter;
}

.sidenote-wrapper > sup::before {
  content: "\2060";
}

.margin-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.margin-toggle-label {
  color: #0000ee;
  cursor: pointer;
  font-size: 0.95em;
}

.margin-toggle-label::after {
  content: counter(sidenote-counter);
}

.sidenote {
  float: right;
  clear: right;
  width: var(--side-width);
  margin: 0.2rem calc(-1 * (var(--side-width) + var(--side-gap))) 1rem 0;
  padding-left: 0.6rem;
  border-left: 1px solid #bdbdbd;
  color: #444;
  font-size: 0.92rem;
  line-height: 1.55;
}

.sidenote::before {
  content: counter(sidenote-counter) ".";
  margin-right: 0.35rem;
}

.sidenote-backdrop {
  display: none;
}

.monologue-block {
  margin: 1.2rem 0;
  padding-left: 0.8rem;
  border-left: 2px solid #bdbdbd;
}

.monologue-block p {
  margin: 0;
}

.monologue-block p + p {
  margin-top: 0.6em;
}

:not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

pre {
  margin: 1.4rem 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9em;
  line-height: 1.5;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: color-mix(in srgb, #0000ee 40%, #6e5d62);
  font-style: italic;
}

.token.keyword,
.token.tag,
.token.operator {
  color: #551a8b;
  font-weight: 600;
}

.token.string,
.token.attr-value {
  color: color-mix(in srgb, #0000ee 72%, #734550);
}

.search-wrapper {
  margin: 1.5rem 0;
}

#search-input {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid #bdbdbd;
  border-radius: 4px;
  font: inherit;
}

#search-input:focus {
  border-color: #0000ee;
  box-shadow: 0 0 0 2px color-mix(in srgb, #0000ee 18%, transparent);
  outline: none;
}

#search-results .search-loading {
  color: #444;
}

.site-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  color: #444;
  font-size: 0.9rem;
  line-height: 1.75;
  text-align: center;
}

.site-footer::before {
  content: "";
  display: block;
  width: 44px;
  margin: 0 auto 0.85rem;
  border-top: 1px solid #bdbdbd;
}

.site-footer p {
  margin: 0.35rem 0;
}

.search-layout .container {
  max-width: calc(1080px - var(--side-width) - var(--side-gap));
  padding: 2.2rem 1.5rem;
}

.search-layout .site-logo {
  position: static;
  display: block;
  width: fit-content;
  margin: 0 auto 1.5rem;
  opacity: 1;
}

#search-title h2 {
  margin-top: 0;
}

@media (max-width: 1050px) {
  .container {
    max-width: 92%;
    padding: 1.25rem;
  }

  .site-logo {
    position: static;
    display: block;
    width: fit-content;
    margin: 0 auto 1.25rem;
    opacity: 1;
  }

  .sidenote {
    display: none;
  }

  .margin-toggle:checked ~ .sidenote-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    z-index: 998;
  }

  .margin-toggle:checked ~ .sidenote {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    margin: 0;
    padding: 1rem 1rem 1.4rem;
    border-left: 0;
    border-top: 1px solid #bdbdbd;
    background: #fff;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 999;
  }

  .search-layout .container {
    padding-top: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
