:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #1b1f23;
  --muted: #5b6673;
  --link: #1f5fbf;
  --link-hover: #184a95;
  --border: #e6e8eb;
  --code-bg: #f5f7fa;
  --code-text: #1f2328;
}

:root[data-theme="dark"] {
  --bg: #0f1216;
  --surface: #0f1216;
  --text: #e6edf3;
  --muted: #9aa4af;
  --link: #6ea8ff;
  --link-hover: #9cc2ff;
  --border: #2a3138;
  --code-bg: #151b23;
  --code-text: #e6edf3;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #1b1f23;
  --muted: #5b6673;
  --link: #1f5fbf;
  --link-hover: #184a95;
  --border: #e6e8eb;
  --code-bg: #f5f7fa;
  --code-text: #1f2328;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0f1216;
    --surface: #0f1216;
    --text: #e6edf3;
    --muted: #9aa4af;
    --link: #6ea8ff;
    --link-hover: #9cc2ff;
    --border: #2a3138;
    --code-bg: #151b23;
    --code-text: #e6edf3;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next", Avenir, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 1.75rem;
}

.layout {
  max-width: 1140px;
  margin: 0 auto;
  padding: 6rem 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 3rem;
  flex: 1;
  width: 100%;
}

.sidebar {
  position: sticky;
  top: 3rem;
}

.site-title {
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 600;
  display: block;
  text-align: left;
}

.site-logo {
  display: block;
  width: 12.6rem;
  height: auto;
  margin-left: 0;
  transform: translateX(-2.2rem) translateY(-0.35rem);
}

.sidebar nav ul {
  list-style: none;
  margin: 3.5rem 0 0;
  padding: 0;
}

.sidebar nav li {
  margin-bottom: 0.45rem;
}

.sidebar nav a {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 600;
}

.sidebar nav a.is-active {
  color: var(--link);
  font-weight: 700;
  text-decoration: none;
  padding: 0.08rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
}

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

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

.content-wrap {
  max-width: 760px;
  padding-top: 4rem;
}

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

.page-header h1 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.25;
}

.meta {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

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

.post-list li {
  display: flex;
  justify-content: space-between;
  gap: 1.2rem;
  align-items: baseline;
  margin-bottom: 0.85rem;
}

.post-list time {
  color: var(--muted);
  min-width: 12.8rem;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

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

.prose img[src*="sec-default.png"] {
  width: min(1200px, calc(100vw - 5rem));
  max-width: none;
  height: auto;
}

@media (max-width: 900px) {
  .prose img[src*="sec-default.png"] {
    width: 100%;
    max-width: 100%;
  }
}

pre,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  overflow-x: auto;
  padding: 0.8rem 1rem;
  border-radius: 4px;
}

code {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.12rem 0.3rem;
  border-radius: 3px;
}

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

.site-footer {
  margin-top: 2.75rem;
  padding: 0 1.25rem 2rem;
  color: var(--muted);
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.site-footer-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 3rem;
}

.site-footer-content {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.site-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.site-footer-copy {
  margin: 0;
}

.site-footer-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.theme-toggle-text {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  padding: 0;
  cursor: pointer;
}

.theme-toggle-text:hover,
.theme-toggle-text:focus-visible {
  color: var(--link-hover);
  text-decoration: underline;
}

.site-footer-actions a {
  display: inline-flex;
  color: var(--muted);
}

.site-footer-actions svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 1.4rem;
    padding-top: 3.7rem;
  }

  .sidebar {
    position: static;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
  }

  .sidebar nav ul {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
  }

  .site-footer {
    padding-top: 0;
  }

  .site-footer-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .site-footer-blank {
    display: none;
  }

  .site-footer-content {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
  }

  .site-footer-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .post-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .post-list time {
    min-width: 0;
    text-align: left;
  }

  .content-wrap {
    padding-top: 0;
  }
}
