@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600&family=Space+Grotesk:wght@400;600;700&display=swap");

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-accent: #f7f9fc;
  --ink: #0f172a;
  --muted: #5b6472;
  --panel: #f5f7fb;
  --panel-accent: #e7edf6;
  --panel-muted: #eef2f7;
  --accent: #0b5fff;
  --accent-dark: #0047cc;
  --mint: #1ea7a1;
  --border: #d6dbe3;
  --shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
  --radius: 8px;
  --tag-bg: #ff7a00;
  --tag-ink: #1f1300;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b111f;
  --bg-accent: #0f172a;
  --ink: #e2e8f0;
  --muted: #9aa6b2;
  --panel: #111827;
  --panel-accent: #1f2937;
  --panel-muted: #0f172a;
  --accent: #7aa2ff;
  --accent-dark: #4f7dff;
  --mint: #2fb1a8;
  --border: #24324d;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --tag-bg: #ff8a1f;
  --tag-ink: #1f1400;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Mono", "Courier New", monospace;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 60%, var(--bg) 100%);
  min-height: 100vh;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 5px;
  width: 100%;
  background: var(--panel-accent);
  z-index: 100;
}

.scroll-progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.1s linear;
}

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

a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.app {
  padding: 28px;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
}

.title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.title-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.title-mark {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--ink);
}

.title-link {
  font-size: 14px;
  font-weight: 600;
}

.title-rule {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--border);
  margin: 4px 0 0;
}

.subtitle {
  color: var(--muted);
  font-size: 14px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.nav-link {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 14px;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

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

.section-title {
  margin: 0 0 4px;
  font-size: 20px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.intro-text p {
  margin-top: 0;
}

.post-date {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 13px;
  font-family: "IBM Plex Mono", "Courier New", monospace;
}

.post-link {
  font-weight: 600;
}

.post-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.post-subtitle {
  color: var(--muted);
  font-size: 14px;
  font-weight: bold;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tag-pill {
  background: var(--tag-bg);
  color: var(--tag-ink);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
}

.post-listing {
  margin-top: 24px;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.post-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  align-items: baseline;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.post-item.no-date {
  grid-template-columns: 1fr;
}

.post-header h1 {
  margin: 0;
  font-size: 28px;
}

.post-header .post-subtitle {
  margin: 6px 0 0;
  font-size: 15px;
}

.post-meta {
  color: var(--muted);
  font-size: 13px;
  margin: 6px 0 0;
  font-family: "IBM Plex Mono", "Courier New", monospace;
}

.post-body {
  margin-top: 18px;
}

.toc {
  margin-top: 20px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.toc-title {
  margin: 0 0 10px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.toc ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.toc li {
  font-size: 14px;
}

.toc a {
  color: var(--ink);
}

.toc ul ul {
  padding-left: 16px;
  margin-top: 6px;
}

.site-footer {
  margin-top: 24px;
  padding: 16px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.footer-rule {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0 0 12px;
}

.footer-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-note {
  max-width: 60%;
}

.footer-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  width: 100%;
}

.footer-links {
  display: inline-flex;
  gap: 12px;
}

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

.footer-license {
  text-align: right;
}

@media (max-width: 720px) {
  .app {
    padding: 24px 16px 32px;
  }

  .toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .controls {
    width: 100%;
  }

  .footer-note {
    max-width: none;
  }

  .footer-meta {
    justify-content: flex-start;
    align-items: flex-start;
    flex-direction: column;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .post-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
