:root {
  --bg: #ffffff;
  --text: #000000;
  --muted: #68635b;
  --faint: #9f9d96;
  --line: #e4e0d8;
  --panel: #f7f7f5;
  --accent: #FA7268;
  --accent-strong: #f66055;
  --code-bg: #f1f3f4;
  --wrap: 37rem;
  --wrap-wide: 54rem;
}

:root.theme-dark {
  --bg: #000000;
  --text: #f2efe7;
  --muted: #aaa397;
  --faint: #6f6e69;
  --line: #37342d;
  --panel: #20211d;
  --accent: #FA7268;
  --accent-strong: #f66055;
  --code-bg: #2b2a25;
}

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

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Lora", Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100%;
  margin: 0;
  padding: 4vw 0 5rem;
  background: var(--bg);
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}

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

a.plain {
  text-decoration: none;
}

.muted {
  color: var(--muted);
}

.muted a,
a.muted {
  color: var(--muted);
}

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

.small {
  font-size: 0.88rem;
  line-height: 1.4;
}

.font-ui {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
}

.site-shell {
  width: min(88vw, var(--wrap-wide));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: min(100%, var(--wrap));
  margin: 0 auto 2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
}

.site-title {
  flex: 1 1 auto;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
}

.site-nav {
  display: flex;
  flex: 0 1 auto;
  gap: 1.25rem;
  align-items: center;
  justify-content: flex-end;
  font-size: 0.88rem;
}

.site-main,
.home-wrap,
.page,
.post {
  width: min(100%, var(--wrap));
  margin: 0 auto;
}

.site-main {
  min-height: 58vh;
}

.theme-toggle {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

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

.theme-toggle-slide {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.theme-toggle-switch {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: currentColor;
  transition: left 120ms ease, background-color 120ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.toggle-icon {
  flex-shrink: 0;
  color: var(--bg);
}

.toggle-moon {
  display: none;
}

.theme-toggle:hover .theme-toggle-switch {
  background: var(--accent);
}

:root.theme-dark .theme-toggle-switch {
  left: 16px;
  background: var(--text);
}

:root.theme-dark .toggle-sun {
  display: none;
}

:root.theme-dark .toggle-moon {
  display: block;
}

p {
  margin: 0 0 1rem;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.5rem;
  line-height: 1.3;
  letter-spacing: 0;
}

h1 {
  margin-top: 1.5rem;
  font-size: clamp(1.65rem, 1.3rem + 0.7vw, 2rem);
  font-weight: 500;
}

h2 {
  margin-top: 2rem;
  font-size: clamp(1.2rem, 1.05rem + 0.25vw, 1.4rem);
  font-weight: 500;
}

h3 {
  margin-top: 1.5rem;
  font-size: 1rem;
  font-weight: 600;
}


.home-label {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.home-section {
  margin-top: 2.5rem;
}

.home-intro {
  margin-bottom: 2rem;
}

.topic-list {
  line-height: 1.75;
}

.index-list {
  display: grid;
  gap: 0.15rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  font-variant-numeric: tabular-nums;
}

.content .index-list {
  margin: 0 0 1rem;
  padding: 0;
}

.index-list li {
  margin: 0;
  padding: 0;
}

.index-list a {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
}

.index-date {
  flex: 0 0 8.5rem;
  white-space: nowrap;
}

.index-title {
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header .meta {
  margin-bottom: 0.5rem;
}

.description,
.meta {
  color: var(--muted);
}

.meta {
  font-size: 0.82rem;
  font-weight: 500;
  text-transform: uppercase;
}

.content {
  font-size: 1rem;
}

.content > * + * {
  margin-top: 1rem;
}

.content h2,
.content h3 {
  margin-top: 2rem;
}

.content ul,
.content ol {
  margin: 0 0 1rem 1.25rem;
  padding: 0;
}

.content li {
  padding: 0.12rem 0;
}

.content li::marker {
  color: var(--faint);
}

.content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

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

.content code {
  padding: 0.1em 0.25em;
  border-radius: 4px;
  background: var(--code-bg);
  font-size: 0.9em;
}

.content pre {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
}

.content pre code {
  padding: 0;
  background: transparent;
}

.content a[target="_blank"]::after {
  content: "\2197";
  display: inline-block;
  font-size: 0.72em;
  margin-left: 0.1em;
  vertical-align: 0.15em;
  font-style: normal;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.tags span,
.tags a {
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: none;
}

.tags a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.site-footer {
  width: min(100%, var(--wrap));
  margin: 4rem auto 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-rule {
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.footer-logo {
  display: block;
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  overflow: hidden;
}

.footer-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 640px) {
  body {
    padding-top: 1.5rem;
  }

  .site-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
  }

  .site-title {
    grid-column: 1;
    grid-row: 1;
  }

  .theme-toggle {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .site-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 1rem;
  }

  .nav-secondary {
    display: none;
  }

  .index-list a {
    gap: 0.9rem;
  }

  .index-date {
    flex-basis: 7.5rem;
  }

  .footer-inner {
    align-items: flex-start;
    gap: 0.85rem;
  }
}
