* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #0f172a;
  color: #e5e7eb;
}

a {
  color: #38bdf8;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}

.site-header {
  border-bottom: 1px solid #1f2937;
  background: #020617;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: #fbbf24;
}

.nav-links a {
  margin-left: 1rem;
  font-size: 0.95rem;
  color: #e5e7eb;
}

.site-footer {
  margin-top: 3rem;
  padding: 1.5rem 0;
  border-top: 1px solid #1f2937;
  font-size: 0.9rem;
  text-align: center;
  color: #9ca3af;
}

h1,
h2,
h3 {
  color: #f9fafb;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

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

.post-card {
  background: #020617;
  border-radius: 1rem;
  padding: 1.2rem;
  margin-bottom: 1rem;
  border: 1px solid #1f2937;
}

.post-card .date {
  font-size: 0.85rem;
  color: #9ca3af;
}

.excerpt {
  margin: 0.5rem 0 0.8rem;
  color: #d1d5db;
}

.post-detail {
  background: #020617;
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid #1f2937;
  margin-top: 1rem;
}

.post-detail .date {
  font-size: 0.9rem;
  color: #9ca3af;
}

.stage {
  font-size: 0.9rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #1f2937;
}

pre {
  background: #0b1120;
  padding: 1rem;
  border-radius: 0.75rem;
  overflow-x: auto;
  font-size: 0.9rem;
  position: relative;
  padding-left: 3.5rem; /* for line numbers */
}

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

/* Line numbers: Shiki wraps lines in span */
pre > code {
  counter-reset: line;
  display: block;
}

pre > code > span {
  display: block;
  counter-increment: line;
  padding-left: 0.5rem;
}

pre > code > span::before {
  content: counter(line);
  display: inline-block;
  width: 2.5rem;
  margin-left: -3.5rem;
  margin-right: 0.5rem;
  text-align: right;
  color: #6b7280;
  user-select: none;
}

.btn-secondary {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 0.9rem;
  border: 1px solid #1f2937;
  background: #111827;
  color: #e5e7eb;
  text-decoration: none;
}

.btn-secondary:hover {
  background: #020617;
}

.flash-messages {
  list-style: none;
  padding: 0.6rem 0.8rem;
  margin: 1rem 0;
  border-radius: 0.75rem;
  background: #0b1120;
  border: 1px solid #1f2937;
}

.page {
  background: #020617;
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid #1f2937;
  margin-top: 1rem;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0.8rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid #1f2937;
}

.badge-category {
  background: #111827;
  color: #fbbf24;
  border-color: #92400e;
}

.badge-tag {
  background: #020617;
  color: #e5e7eb;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* Copy button + wrapper */
.code-block-wrapper {
  position: relative;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 999px;
  border: 1px solid #1f2937;
  background: #111827;
  color: #e5e7eb;
  cursor: pointer;
  opacity: 0.85;
}

.code-copy-btn:hover {
  opacity: 1;
  background: #020617;
}

.code-copy-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Search bar */
.search-bar {
  margin: 1rem 0 1.5rem;
}

.search-input {
  width: 100%;
  max-width: 400px;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
}

.search-input:focus {
  outline: 2px solid #38bdf8;
  outline-offset: 1px;
}

.search-hint {
  font-size: 0.85rem;
  color: #9ca3af;
  margin-top: 0.3rem;
}

.post-card.hidden {
  display: none;
}
