/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Linux Libertine', Georgia, 'DejaVu Serif', serif;
  font-size: 14.5px;
  line-height: 1.6;
  color: #202122;
  background: #f6f6f6;
}
a { color: #36c; text-decoration: none; }
a:hover { text-decoration: underline; }
a:visited { color: #6b4ba1; }
button { font-family: inherit; }
mark { background: #fff7b3; padding: 0 1px; }

/* ---------- Top bar ---------- */
#topbar {
  background: #fff;
  border-bottom: 1px solid #a2a9b1;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1400px;
  padding: 10px 18px;
  margin: 0 auto;
}
.brand { display: flex; align-items: baseline; gap: 8px; color: #202122 !important; }
.brand:hover { text-decoration: none; }
.brand-mark {
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 28px;
  background: #36c;
  color: #fff;
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center; justify-content: center;
  border-radius: 4px;
  align-self: center;
}
.brand-name { font-size: 22px; font-weight: 700; }
.brand-tag { font-size: 12px; color: #54595d; font-style: italic; }
.search { margin-left: auto; display: flex; gap: 6px; flex: 1; max-width: 560px; }
.search input {
  flex: 1;
  padding: 7px 10px;
  font-size: 14px;
  border: 1px solid #a2a9b1;
  border-radius: 2px;
  background: #fff;
}
.search input:focus { outline: 2px solid #36c; outline-offset: -1px; border-color: #36c; }
.search button {
  padding: 7px 14px;
  font-size: 14px;
  border: 1px solid #a2a9b1;
  background: linear-gradient(to bottom, #fff, #f0f0f0);
  border-radius: 2px;
  cursor: pointer;
}
.search button:hover { background: linear-gradient(to bottom, #f8f9fa, #e6e6e6); }

/* ---------- Layout ---------- */
#layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  background: #fff;
  border-left: 1px solid #c8ccd1;
  border-right: 1px solid #c8ccd1;
  min-height: calc(100vh - 130px);
}

/* ---------- Sidebar ---------- */
#sidebar {
  border-right: 1px solid #eaecf0;
  background: #f8f9fa;
  padding: 16px 12px;
  font-size: 13px;
}
#sidebar h3 {
  font-family: 'Linux Libertine', Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  color: #54595d;
  text-transform: none;
  margin: 14px 0 4px 4px;
  border-bottom: 1px solid #c8ccd1;
  padding-bottom: 2px;
}
#sidebar ul { list-style: none; padding: 0; margin: 0 0 4px 0; }
#sidebar li { padding: 2px 4px; }
#sidebar .sidebar-cats li { display: flex; justify-content: space-between; gap: 6px; }
#sidebar .sidebar-cats .count { color: #72777d; font-size: 12px; }
.link-btn {
  background: none; border: 0; color: #36c; padding: 0; cursor: pointer; font: inherit;
}
.link-btn:hover { text-decoration: underline; }
.muted { color: #72777d; font-style: italic; }

/* ---------- Content ---------- */
#content {
  padding: 18px 32px 60px 32px;
  min-width: 0;
}
#content:focus { outline: none; }
h1.firstHeading {
  font-family: 'Linux Libertine', Georgia, serif;
  font-size: 28px;
  font-weight: 400;
  border-bottom: 1px solid #a2a9b1;
  padding-bottom: 6px;
  margin: 0 0 14px 0;
}
h2.section {
  font-family: 'Linux Libertine', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  border-bottom: 1px solid #a2a9b1;
  padding-bottom: 4px;
  margin: 24px 0 12px 0;
}
h3.subsection {
  font-size: 16px;
  font-weight: 700;
  margin: 18px 0 8px 0;
}
p { margin: 0.6em 0; }
ul.bullets { padding-left: 24px; }

/* ---------- Article view ---------- */
.infobox {
  float: right;
  width: 280px;
  margin: 0 0 16px 16px;
  background: #f8f9fa;
  border: 1px solid #a2a9b1;
  font-size: 13px;
  padding: 0;
}
.infobox .ib-header {
  background: #eaecf0;
  font-weight: 700;
  text-align: center;
  padding: 6px 8px;
  border-bottom: 1px solid #a2a9b1;
}
.infobox table { width: 100%; border-collapse: collapse; }
.infobox th, .infobox td {
  text-align: left;
  vertical-align: top;
  padding: 5px 8px;
  border-top: 1px solid #eaecf0;
}
.infobox th { width: 38%; font-weight: 700; color: #54595d; background: #fbfbfb; }
.tag-list, .keyword-list { display: flex; flex-wrap: wrap; gap: 4px 6px; padding: 0; margin: 0; list-style: none; }
.tag-list li, .keyword-list li { background: #eaf3ff; border: 1px solid #c8d8ee; border-radius: 2px; padding: 1px 6px; font-size: 12px; }
.keyword-list li a, .tag-list li a { color: #36c; }

.article-content { max-width: 760px; }
.article-content pre, .article-content .text-dump {
  background: #f8f9fa;
  border: 1px solid #eaecf0;
  padding: 10px 12px;
  font-family: 'Consolas', 'Menlo', monospace;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 13px;
  max-height: 540px;
  overflow: auto;
}
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px 0; }
.toolbar a, .toolbar button {
  display: inline-block;
  padding: 5px 10px;
  border: 1px solid #a2a9b1;
  border-radius: 2px;
  background: linear-gradient(to bottom, #fff, #f0f0f0);
  color: #202122;
  font-size: 13px;
  cursor: pointer;
}
.toolbar a:hover, .toolbar button:hover { text-decoration: none; background: linear-gradient(to bottom, #f8f9fa, #e6e6e6); }
.toolbar .danger { color: #b32424; }

/* ---------- Search results ---------- */
.results { list-style: none; padding: 0; margin: 0; }
.results li {
  padding: 12px 0;
  border-bottom: 1px solid #eaecf0;
}
.results .title { font-size: 17px; font-weight: 400; }
.results .meta { color: #54595d; font-size: 12.5px; margin: 2px 0 4px 0; }
.results .snippet { color: #202122; font-size: 13.5px; }
.results .snippet mark { background: #fff7b3; }
.results .keywords { font-size: 12px; color: #72777d; margin-top: 3px; }

.pagination { margin: 16px 0; display: flex; gap: 8px; align-items: center; }

/* ---------- Tiles (recent / category) ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.tile {
  border: 1px solid #c8ccd1;
  background: #fff;
  padding: 10px 12px;
  border-radius: 2px;
}
.tile .title { font-size: 15px; font-weight: 700; }
.tile .meta { color: #54595d; font-size: 12px; margin: 2px 0 4px 0; }
.tile .summary { font-size: 13px; color: #333; }

/* ---------- Upload ---------- */
.dropzone {
  border: 2px dashed #a2a9b1;
  border-radius: 4px;
  padding: 36px 20px;
  text-align: center;
  background: #f8f9fa;
  color: #54595d;
  cursor: pointer;
}
.dropzone.drag { border-color: #36c; background: #eaf3ff; color: #202122; }
.upload-list { margin-top: 14px; }
.upload-list li.ok { color: #14866d; }
.upload-list li.err { color: #b32424; }

/* ---------- Edit form ---------- */
.edit-form { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; max-width: 640px; margin: 14px 0; }
.edit-form label { padding-top: 6px; color: #54595d; }
.edit-form input, .edit-form textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #a2a9b1;
  border-radius: 2px;
  font: inherit;
}

/* ---------- MOTD card ---------- */
.motd-card {
  background: linear-gradient(135deg, #fff8d6 0%, #fff3b3 100%);
  border-left: 5px solid #f0a800;
  border-radius: 3px;
  padding: 16px 20px;
  margin: 0 0 22px 0;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.motd-quote {
  font-family: Georgia, serif;
  font-size: 36px;
  line-height: 1;
  color: #c08300;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: -2px;
}
.motd-body { flex: 1; min-width: 0; }
.motd-tag {
  font-size: 11px;
  color: #8a6800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
  font-family: 'Linux Libertine', Georgia, serif;
}
.motd-text {
  font-style: italic;
  font-size: 15.5px;
  color: #3a3a3a;
  line-height: 1.45;
}
.motd-actions {
  margin-top: 6px;
  font-size: 12px;
}
.motd-refresh {
  background: none;
  border: 0;
  cursor: pointer;
  color: #8a6800;
  font-size: 12px;
  padding: 0;
  font-family: inherit;
}
.motd-refresh:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
#footer {
  border-top: 1px solid #c8ccd1;
  background: #f8f9fa;
  margin-top: 30px;
  padding: 12px 0;
  font-size: 12px;
  color: #72777d;
}
.footer-inner { max-width: 1400px; margin: 0 auto; padding: 0 18px; text-align: center; }

/* ---------- Keyword cloud ---------- */
.cloud { line-height: 2.2; max-width: 900px; }
.cloud a { margin-right: 8px; }
.cloud .w1 { font-size: 12px; color: #72777d; }
.cloud .w2 { font-size: 14px; }
.cloud .w3 { font-size: 16px; }
.cloud .w4 { font-size: 19px; font-weight: 700; }
.cloud .w5 { font-size: 23px; font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  #layout { grid-template-columns: 1fr; }
  #sidebar { border-right: 0; border-bottom: 1px solid #eaecf0; }
  .infobox { float: none; width: auto; margin: 0 0 16px 0; }
  .topbar-inner { flex-wrap: wrap; }
  .brand-tag { display: none; }
}
