:root {
  --color-bg: #fff;
  --color-text: #333;
  --color-anchor: #337ab7;
  --color-heading: #111;
  --color-divider: #cdcdcd;
  --color-code-bg: #f7f7f7;
  --color-code-text: #333;
  --color-table-border: #c2c2c2;
  --color-table-row-even: #f0f0f0;
  --color-table-row-odd: #fff;
  --color-toggle-accent: #c3a554;
  --color-meta: #515151;
  --color-brand-grey: #8a8a8a;
  --color-brand-side: #111;
}

html.dark {
  --color-bg: #1c1c1c;
  --color-text: #e5e5e5;
  --color-anchor: #c3a554;
  --color-heading: #fff;
  --color-divider: #444;
  --color-code-bg: #2d2d2d;
  --color-code-text: #f7f7f7;
  --color-table-border: #444;
  --color-table-row-even: #262626;
  --color-table-row-odd: #1c1c1c;
  --color-meta: #888;
  --color-brand-grey: #9a9a9a;
  --color-brand-side: #fff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  line-height: 1.8;
  background: var(--color-bg);
  color: var(--color-text);
}

a { color: var(--color-anchor); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
  color: var(--color-heading);
  line-height: 1.25;
  margin-top: 1.2em;
  margin-bottom: 0.6em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }

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

.markdown-body {
  width: 66vw;
  max-width: 1400px;
  margin: auto;
  padding: 40px 24px;
  position: relative;
  letter-spacing: 0.025em;
}

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

.site-title {
  font-size: 3.25rem;
  font-weight: 600;
  margin: 0 0 0.6rem;
}

.site-title a { text-decoration: none; }
.site-title a:hover { text-decoration: none; }

.brand-grey {
  color: var(--color-brand-grey);
  font-style: italic;
}
.brand-side { color: var(--color-brand-side); }

.site-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
  padding: 8px 0;
  margin: 0;
}

.toc-category {
  display: inline-block;
  min-width: 120px;
  padding: 10px 8px;
  text-align: center;
  font-size: 1.2rem;
}

.toc-category.is-current {
  font-weight: 600;
  text-decoration: underline;
}

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

.empty-list {
  color: var(--color-meta);
  text-align: center;
  margin-top: 2rem;
}

.post-list > li { margin-bottom: 36px; }

.post-link {
  display: block;
  font-size: 32px;
}

.post-meta {
  display: block;
  font-size: 16px;
  color: var(--color-meta);
}

.post-tags {
  margin: 0.2em 0 0;
  font-size: 16px;
}

.post-tags a { margin-right: 0.75em; }

.post-tags-article {
  padding-top: 0.2em;
  margin-bottom: 1.5rem;
}

.tag-heading {
  font-size: 1.3rem;
  font-weight: 400;
  margin-top: 0;
  margin-bottom: 1.5rem;
}

article .post-title {
  font-size: 2.5rem;
  font-weight: 600;
  margin-top: 0;
  padding-bottom: 0.3em;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-divider);
}

article {
  font-size: 1.25rem;
}

article p,
article li {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}

.post-meta-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4em;
}

article .post-date,
article .see-all {
  color: var(--color-meta);
  font-size: 0.85rem;
}

article .see-all a { color: var(--color-meta); }

.pager {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-divider);
}

.pager .is-current { font-weight: 600; }

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}
.markdown-body th,
.markdown-body td {
  border: 1px solid var(--color-table-border);
  padding: 0.6em 0.8em;
}
.markdown-body table tr:nth-child(2n) { background: var(--color-table-row-even); }
.markdown-body blockquote {
  margin: 0 0 1em;
  padding: 0 1em;
  border-left: 4px solid var(--color-divider);
  opacity: 0.8;
}
.markdown-body code {
  background: var(--color-code-bg);
  color: var(--color-code-text);
  padding: 0.2em 0.4em;
  border-radius: 4px;
}
.markdown-body pre {
  background: var(--color-code-bg);
  color: var(--color-code-text);
  padding: 0.8em;
  overflow: auto;
  border-radius: 4px;
}
.markdown-body pre code { padding: 0; background: transparent; }
.markdown-body hr {
  height: 0.25em;
  padding: 0;
  margin: 24px 0;
  background-color: var(--color-divider);
  border: 0;
}

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

.h-6 { height: 1.5rem; }
.w-6 { width: 1.5rem; }

#color-mode-switch {
  position: absolute;
  top: 16px;
  right: 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

#color-mode-switch svg {
  width: 24px;
  height: 24px;
  margin: 0 4px;
}

#color-mode-switch input[type="checkbox"] {
  height: 0;
  width: 0;
  margin: 0;
  visibility: hidden;
}

#color-mode-switch label {
  cursor: pointer;
  text-indent: -9999px;
  width: 42px;
  height: 21px;
  border-radius: 30px;
  background: var(--color-toggle-accent);
  display: block;
  position: relative;
  margin: 0;
}

#color-mode-switch label:after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  background: #fff;
  border-radius: 90px;
  transition: 0.3s;
}

#color-mode-switch input:checked + label:after {
  left: calc(100% - 3px);
  transform: translateX(-100%);
}

@media (max-width: 800px) {
  .markdown-body {
    width: 100%;
    max-width: none;
    padding: 56px 20px 40px;
  }
  .site-title { padding: 0 72px; font-size: 2.5rem; }
  .post-link { font-size: 26px; }
  .toc-category { min-width: 88px; font-size: 1.1rem; }
  #color-mode-switch { top: 12px; right: 12px; }
}
