:root {
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --header-bg: #0f1e33;
  --header-accent: #1e3a5f;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --text: #1e293b;
  --text-muted: #64748b;
  --pdf-bg: #fef2f2;
  --pdf-fg: #b91c1c;
  --md-bg: #f0fdf4;
  --md-fg: #15803d;
  --other-bg: #f1f5f9;
  --other-fg: #475569;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.12), 0 2px 4px rgba(0,0,0,0.06);
  --radius: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Header ─────────────────────────────────── */
header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-accent);
  padding: 1.25rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-title {
  color: #f8fafc;
  font-size: 1.15rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.site-title:hover { color: #cbd5e1; }

.search-bar {
  display: flex;
  flex: 1;
  min-width: 200px;
  max-width: 500px;
  gap: 0.4rem;
}

.search-bar input {
  flex: 1;
  padding: 0.5rem 0.9rem;
  border: 1px solid #334155;
  border-radius: 6px;
  background: #1e3a5f;
  color: #f8fafc;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.search-bar input::placeholder { color: #94a3b8; }
.search-bar input:focus { border-color: var(--accent); }

.search-bar button {
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s;
  white-space: nowrap;
}

.search-bar button:hover { background: var(--accent-hover); }

.clear-btn {
  background: #334155 !important;
}
.clear-btn:hover { background: #475569 !important; }

/* ── Main ────────────────────────────────────── */
main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem 3rem;
}

.loading, .empty {
  text-align: center;
  color: var(--text-muted);
  padding: 4rem 1rem;
  font-size: 1rem;
}

/* ── Artifact Grid ───────────────────────────── */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.list-header h2 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
}

.artifact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}

/* ── Card ────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid var(--border);
  transition: transform 0.12s, box-shadow 0.12s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
}

.card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Type Badge ──────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.18em 0.55em;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-pdf  { background: var(--pdf-bg); color: var(--pdf-fg); }
.badge-md   { background: var(--md-bg);  color: var(--md-fg); }
.badge-other { background: var(--other-bg); color: var(--other-fg); }

/* ── Tags ────────────────────────────────────── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.tag {
  background: var(--other-bg);
  color: var(--text-muted);
  padding: 0.15em 0.55em;
  border-radius: 4px;
  font-size: 0.72rem;
}

/* ── Artifact Detail ─────────────────────────── */
.artifact-detail {
  max-width: 960px;
  margin: 0 auto;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.back-btn:hover { text-decoration: underline; }

.artifact-header {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.artifact-header h1 {
  font-size: 1.5rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.artifact-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.artifact-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.artifact-desc {
  color: var(--text-muted);
  line-height: 1.65;
  font-size: 0.95rem;
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent);
  font-size: 0.875rem;
  text-decoration: none;
  margin-top: 0.25rem;
}

.github-link:hover { text-decoration: underline; }

/* ── Main Content Area ───────────────────────── */
.main-content {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.pdf-viewer {
  width: 100%;
  height: 80vh;
  min-height: 500px;
  border: none;
  display: block;
}

.markdown-body {
  padding: 2rem;
  max-width: 800px;
  font-size: 0.95rem;
  line-height: 1.75;
}

.markdown-body h1 { font-size: 1.6rem; margin: 1.5rem 0 0.75rem; }
.markdown-body h2 { font-size: 1.3rem; margin: 1.5rem 0 0.5rem; }
.markdown-body h3 { font-size: 1.1rem; margin: 1.25rem 0 0.4rem; }
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
  font-size: 1rem;
  margin: 1rem 0 0.35rem;
}

.markdown-body p { margin-bottom: 1rem; }
.markdown-body ul, .markdown-body ol {
  margin: 0.5rem 0 1rem 1.5rem;
}
.markdown-body li { margin-bottom: 0.25rem; }

.markdown-body blockquote {
  border-left: 3px solid var(--border);
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  margin: 1rem 0;
}

.markdown-body code {
  background: var(--other-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.88em;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.markdown-body pre {
  background: #0f1e33;
  color: #e2e8f0;
  padding: 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1rem 0;
  font-size: 0.875rem;
}

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

.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.markdown-body th, .markdown-body td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.markdown-body th { background: var(--other-bg); font-weight: 600; }

.markdown-body a { color: var(--accent); }
.markdown-body a:hover { text-decoration: underline; }

.markdown-body img { max-width: 100%; border-radius: 6px; }

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.markdown-raw {
  padding: 1.5rem;
  white-space: pre-wrap;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text);
}

.download-link {
  display: block;
  padding: 2.5rem;
  text-align: center;
  color: var(--accent);
  text-decoration: none;
  font-size: 1rem;
}

.download-link:hover { text-decoration: underline; }

/* ── Files Section ───────────────────────────── */
.files-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
}

.files-section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.file-list {
  list-style: none;
}

.file-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.file-list li:last-child { border-bottom: none; }

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

.file-list a:hover { text-decoration: underline; }

/* ── No-index warning ────────────────────────── */
.no-index-notice {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  color: #92400e;
  margin-bottom: 1.25rem;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 600px) {
  .header-inner { flex-direction: column; align-items: stretch; }
  .search-bar { max-width: 100%; }
  .artifact-grid { grid-template-columns: 1fr; }
  .artifact-header h1 { font-size: 1.2rem; }
  .markdown-body { padding: 1rem; }
  .pdf-viewer { height: 60vh; }
}
