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

:root {
  --bg: #0b0b0d;
  --window-bg: #131315;
  --window-border: rgba(255, 255, 255, 0.08);
  --titlebar-border: rgba(255, 255, 255, 0.055);
  --accent: #d97757;
  --accent-soft: rgba(217, 119, 87, 0.85);
  --accent-faint: rgba(217, 119, 87, 0.14);
  --text: #e8e8eb;
  --text-body: #c9c9d1;
  --text-soft: #a5a5b0;
  --muted: #6e6e78;
  --muted-2: #55555f;
  --muted-3: #3e3e47;
  --row-hover: rgba(255, 255, 255, 0.032);
  --user-bg: rgba(255, 255, 255, 0.032);
  --code-bg: rgba(255, 255, 255, 0.04);
  --rule: rgba(255, 255, 255, 0.07);
  --mono: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace, Menlo, Monaco, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Inter", "Helvetica Neue", sans-serif;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.stage {
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(16px, 4.5vh, 48px) clamp(12px, 3vw, 24px);
}

.window {
  width: 100%;
  max-width: 720px;
  background: var(--window-bg);
  border: 1px solid var(--window-border);
  border-radius: 12px;
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.68),
    0 6px 20px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

/* Sticky minimalist titlebar */
.titlebar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: rgba(19, 19, 21, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--titlebar-border);
  user-select: none;
}

.lights {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 76px;
}

.dot {
  width: 9.5px;
  height: 9.5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
  transition: background-color 180ms ease;
}

.window:hover .dot-close {
  background: rgba(255, 95, 86, 0.72);
}

.window:hover .dot-min {
  background: rgba(255, 189, 46, 0.72);
}

.window:hover .dot-max {
  background: rgba(39, 201, 63, 0.72);
}

.window-title {
  font-size: 11.25px;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.34);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.titlebar-right {
  width: 76px;
  display: flex;
  justify-content: flex-end;
}

.home-link {
  font-size: 11px;
  color: var(--muted-2);
  text-decoration: none;
  transition: color 150ms ease;
}

.home-link:hover {
  color: var(--accent-soft);
}

.progress-bar {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 1.5px;
  width: 0%;
  background: var(--accent);
  opacity: 0;
  transition: opacity 180ms ease;
}

.progress-bar.visible {
  opacity: 0.85;
}

/* Main shell container */
.shell {
  padding: clamp(18px, 3vw, 28px) clamp(16px, 3.6vw, 30px) 16px;
}

/* Index header */
.blog-header {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 20px;
}

.blog-brand {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 14px;
}

.star {
  color: var(--accent);
}

.blog-name {
  color: var(--text);
  font-weight: 600;
}

.blog-sub {
  color: var(--text-soft);
}

.blog-tagline {
  font-size: 12px;
  color: var(--muted);
  padding-left: 19px;
}

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

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

/* Command / Filter bar */
.command-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.user-line {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--user-bg);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 11px;
  transition: border-color 150ms ease;
}

.user-line:focus-within {
  border-color: rgba(217, 119, 87, 0.35);
}

.chevron {
  color: var(--muted);
  user-select: none;
  flex-shrink: 0;
}

.cmd-prefix {
  color: var(--accent-soft);
  font-size: 12.2px;
}

.cmd-flag {
  color: var(--muted);
  font-size: 12.2px;
}

.search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.2px;
}

.search-input::placeholder {
  color: var(--muted-2);
}

.tag-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 2px 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.tag-btn:hover {
  color: var(--text-soft);
  border-color: rgba(255, 255, 255, 0.16);
}

.tag-btn.active {
  color: var(--accent);
  border-color: rgba(217, 119, 87, 0.45);
  background: var(--accent-faint);
}

.result-meta {
  font-size: 11.2px;
  color: var(--muted-2);
  margin-bottom: 8px;
}

/* Post list (CLI directory table feel) */
.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  margin-bottom: 22px;
  border-top: 1px solid var(--rule);
}

.post-item {
  border-bottom: 1px solid var(--rule);
}

.post-link {
  width: 100%;
  appearance: none;
  background: transparent;
  border: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 14px 86px 1fr auto;
  align-items: baseline;
  gap: 12px;
  padding: 13px 6px;
  border-radius: 4px;
  transition: background-color 140ms ease;
  font-family: inherit;
}

.post-link:hover,
.post-link.selected {
  background: var(--row-hover);
}

.post-cursor {
  color: var(--accent);
  font-size: 12px;
  opacity: 0;
  transition: opacity 120ms ease;
}

.post-link:hover .post-cursor,
.post-link.selected .post-cursor {
  opacity: 1;
}

.post-date {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.post-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.post-title {
  font-family: var(--sans);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  transition: color 140ms ease;
}

.post-link:hover .post-title,
.post-link.selected .post-title {
  color: #ffffff;
}

.post-excerpt {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted-2);
  white-space: nowrap;
}

.post-tag {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  border-radius: 3px;
}

.empty-state {
  padding: 28px 6px;
  font-size: 12.5px;
  color: var(--muted);
  font-style: italic;
}

/* ARTICLE VIEW */
.tool-header {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 16px;
}

.tool-call {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0;
  font-size: 12.5px;
}

.bullet {
  color: var(--accent);
  font-size: 10px;
  margin-right: 9px;
  transform: translateY(-1px);
}

.tool-fn {
  color: var(--text);
  font-weight: 600;
}

.tool-path {
  color: var(--text-soft);
  word-break: break-all;
}

.tool-sub {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.branch {
  color: var(--muted-3);
  margin-right: 7px;
}

.article-meta {
  flex: 1;
  min-width: 180px;
}

.back-btn,
.back-cmd {
  appearance: none;
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent-soft);
  cursor: pointer;
  padding: 2px 0;
  transition: color 140ms ease;
}

.back-btn:hover,
.back-cmd:hover {
  color: var(--accent);
}

.back-cmd {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* Editorial long-form reading typography */
.prose {
  font-family: var(--sans);
  font-size: clamp(14.5px, 0.4vw + 13.5px, 15.5px);
  line-height: 1.9;
  color: var(--text-body);
  padding: 26px 4px 12px;
  max-width: 620px;
}

.prose h1 {
  font-size: clamp(21px, 1.8vw + 15px, 25px);
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin-bottom: 10px;
}

.prose .lead {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 26px;
}

.prose h2 {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text);
  margin: 30px 0 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.prose h2::before {
  content: "##";
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--accent-soft);
}

.prose h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 10px;
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.prose h3::before {
  content: "###";
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}

.prose p {
  margin-bottom: 18px;
}

.prose strong {
  color: var(--text);
  font-weight: 600;
}

.prose blockquote {
  margin: 22px 0;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--accent-soft);
  color: var(--text-soft);
  font-style: italic;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--text);
  background: var(--code-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

.prose pre {
  margin: 20px 0;
  padding: 14px 16px;
  background: #0e0e10;
  border: 1px solid var(--rule);
  border-radius: 7px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-soft);
}

.prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.prose ul,
.prose ol {
  margin: 0 0 18px 22px;
}

.prose li {
  margin-bottom: 7px;
}

.prose li > ul,
.prose li > ol {
  margin-top: 6px;
  margin-bottom: 4px;
}

.prose hr {
  border: none;
  text-align: center;
  margin: 28px 0;
  color: var(--muted-3);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.6em;
}

.prose hr::before {
  content: "···";
}

.prose a,
.term-link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(217, 119, 87, 0.55);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 150ms ease, text-decoration-color 150ms ease;
}

.prose a:hover,
.term-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* Article footer & pager */
.article-footer {
  margin-top: 24px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.pager-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-soft);
  font-family: var(--sans);
  font-size: 12.5px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  max-width: 48%;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.pager-btn.next {
  margin-left: auto;
  text-align: right;
}

.pager-btn:hover {
  border-color: rgba(217, 119, 87, 0.45);
  background: var(--row-hover);
}

.pager-dir {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
}

.article-signoff {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
}

.signoff-links {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Bottom status bar */
.composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rule {
  height: 1px;
  background: var(--rule);
}

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 10.8px;
  color: var(--muted-2);
  user-select: none;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 5.5px;
  height: 5.5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.78;
}

.status-right {
  color: var(--muted-2);
}

/* Mobile adaptation */
@media (max-width: 600px) {
  .window {
    border-radius: 10px;
  }

  .lights,
  .titlebar-right {
    width: 58px;
  }

  .post-link {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 13px 4px;
  }

  .post-cursor {
    display: none;
  }

  .post-right {
    margin-top: 2px;
  }

  .prose {
    padding: 18px 0 8px;
  }

  .pager-btn {
    max-width: 100%;
    width: 100%;
  }

  .pager-btn.next {
    text-align: left;
  }

  .status-right {
    display: none;
  }
}
