@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;1,400&display=swap');

/* ─── Variables ─────────────────────────────────────────── */
:root {
  --bg:           #f7f6f1;
  --surface:      #ffffff;
  --border:       #d8d5cc;
  --border-light: #eeecea;
  --text:         #1a1917;
  --muted:        #6b6860;
  --accent:       #1a3a5c;
  --accent-light: #e8eff7;
  --header-h:     49px;
  --nav-h:        41px;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'IBM Plex Sans', sans-serif;

  /* Tag color palette — 12 distinct colors, auto-assigned by JS */
  --tag-0: #1a3a5c; --tag-0-bg: #e8eff7;
  --tag-1: #6b2d00; --tag-1-bg: #fdf0e6;
  --tag-2: #1a4a2e; --tag-2-bg: #eaf5ee;
  --tag-3: #4a1a5c; --tag-3-bg: #f3eaf7;
  --tag-4: #5c1a1a; --tag-4-bg: #fceaea;
  --tag-5: #1a4a4a; --tag-5-bg: #eaf5f5;
  --tag-6: #3a3a00; --tag-6-bg: #f7f7e0;
  --tag-7: #003a3a; --tag-7-bg: #e0f2f2;
  --tag-8: #3a001a; --tag-8-bg: #f7e0ea;
  --tag-9: #001a3a; --tag-9-bg: #e0eaf7;
  --tag-10: #1a3a00; --tag-10-bg: #eaf7e0;
  --tag-11: #3a1a00; --tag-11-bg: #f7ede0;
}

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

/* ─── Base ───────────────────────────────────────────────── */
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ─── Header ─────────────────────────────────────────────── */
#site-header {
  background: var(--accent);
  color: #fff;
  padding: 0 24px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

#site-header h1 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

#site-header a.home-link {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  letter-spacing: 0.04em;
}

#site-header a.home-link:hover { color: #fff; }

#search {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  padding: 5px 12px;
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
  width: 200px;
  outline: none;
}

#search::placeholder { color: rgba(255,255,255,0.45); }
#search:focus { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.5); }

/* ─── Tab nav ────────────────────────────────────────────── */
#tab-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  overflow-x: auto;
  position: sticky;
  top: var(--header-h);
  z-index: 99;
  scrollbar-width: none;
}

#tab-nav::-webkit-scrollbar { display: none; }

#tab-nav button {
  background: none;
  border: none;
  padding: 10px 15px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s;
}

#tab-nav button.active { color: var(--accent); border-bottom-color: var(--accent); }
#tab-nav button:hover:not(.active) { color: var(--text); }

/* ─── Main content ───────────────────────────────────────── */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

.tab-section { display: none; }
.tab-section.active { display: block; }

/* ─── Typography within sections ────────────────────────── */
.tab-section h2 {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 32px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.tab-section h2:first-child { margin-top: 0; }

.tab-section h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  margin: 16px 0 6px;
}

.tab-section p {
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.65;
}

.tab-section ul, .tab-section ol {
  padding-left: 20px;
  margin-bottom: 10px;
}

.tab-section li { margin-bottom: 4px; }

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

/* ─── Tables ─────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0 12px;
}

th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 4px 10px 6px 0;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  line-height: 1.5;
}

tr:last-child td { border-bottom: none; }

/* ─── Inline images (SVG icons) ──────────────────────────── */
.tab-section img {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-right: 6px;
  margin-top: -2px;
}

/* Images inside tables: let the width/height HTML attributes control size */
.tab-section table img {
  width: unset;
  height: unset;
  margin: 0 auto 4px;
  display: block;
}

/* ─── Tag pills ──────────────────────────────────────────── */
.tag-pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  cursor: default;
  vertical-align: middle;
  margin: 0 2px;
  white-space: nowrap;
}

/* ─── Tags index tab ─────────────────────────────────────── */
.tags-group { margin-bottom: 28px; }

.tags-group-header {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tags-group-count {
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
}

.tag-entry {
  display: flex;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  line-height: 1.5;
}

.tag-entry:last-child { border-bottom: none; }

.tag-entry-source {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 2px;
  min-width: 80px;
}

.tag-entry-text { flex: 1; }

.tag-entry-link {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  padding-top: 2px;
  opacity: 0.6;
}

.tag-entry-link:hover { opacity: 1; }

/* ─── Search results ─────────────────────────────────────── */
#search-results { display: none; }
#search-results.active { display: block; }

.search-hit {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
}

.search-hit:hover { border-color: var(--accent); }

.search-hit-source {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.search-hit-text { font-size: 13px; line-height: 1.5; }
mark { background: #fff3b0; border-radius: 2px; padding: 0 1px; }

.empty-state {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  padding: 24px 0;
}

/* ─── Landing page (index) ───────────────────────────────── */
.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.landing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 20px 16px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.landing-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(26,58,92,0.08);
}

.landing-card-title {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 6px;
}

.landing-card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.landing-card-arrow {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--border);
  margin-top: 14px;
  display: block;
  transition: color 0.15s;
}

.landing-card:hover .landing-card-arrow { color: var(--accent); }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  #site-header { flex-wrap: wrap; gap: 8px; height: auto; padding: 10px 16px; }
  #search { width: 100%; }
  main { padding: 20px 16px 60px; }
}

/* ─── Print ──────────────────────────────────────────────── */
@media print {
  #site-header, #tab-nav { position: static; }
  .tab-section { display: block !important; }
  #search-results { display: none !important; }
}

/* ── Semantic color spans ────────────────────────────────── */
/* Usage in markdown: [text]{.warn} [text]{.note} etc.       */

.warn {
  color: #7a3b0a;
  background: #fdf0e6;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.95em;
}

.note {
  color: #1a3a5c;
  background: #e8eff7;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.95em;
}

.ok {
  color: #1a4a2e;
  background: #eaf5ee;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.95em;
}

.critical {
  color: #5c1a1a;
  background: #fceaea;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.95em;
}

.muted {
  color: #6b6860;
  font-size: 0.95em;
}

/* ── Icon table — centers icons and labels neatly ────────── */
.tab-section table td img,
.tab-section table th img {
  display: block;
  margin: 0 auto 4px;
}
