/* Reset & Base */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  line-height: 1.6;
  background: #f9f9f9;
  color: #333;
}

/* Navbar (grid layout: left | center | right) */
.navbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  background: #222;
  color: #fff;
  padding: 10px 30px;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  box-sizing: border-box;
}
.navbar-left { justify-self: start; }
.logo { height: 40px; width: auto; vertical-align: middle; }
.logo-text { font-weight: bold; font-size: 18px; color: #fff; }
.navbar-center { justify-self: center; display: flex; gap: 20px; }
.navbar-center a {
  color: #fff;
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 4px;
  transition: background 0.3s ease;
}
.navbar-center a:hover { background: #333; }
.navbar-center a.active { background: #444; }
.navbar-right { justify-self: end; display: flex; align-items: center; gap: 10px; }
#searchBox {
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid #555;
  background: #fff;
  color: #222;
  max-width: 180px;
}
#darkToggle {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 4px;
}
#darkToggle:hover { background: #333; }

@media (max-width: 768px) {
  .navbar { grid-template-columns: 1fr; gap: 10px; text-align: center; }
  .navbar-center { flex-direction: column; gap: 10px; }
  .navbar-right { justify-content: center; }
}

/* Scroll to Top */
#scrollTop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #444;
  color: #fff;
  border: none;
  padding: 10px 15px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: none;
  z-index: 999;
}

/* Dark Mode */
body.dark { background: #121212; color: #ddd; }
body.dark .navbar { background: #111; }
body.dark .navbar-center a { color: #ddd; }
body.dark .navbar-center a:hover { background: #222; }
body.dark #searchBox { background: #222; color: #ddd; border: 1px solid #555; }
body.dark .container { background: #1e1e1e; color: #ddd; }
body.dark .footer { background: #111; color: #ddd; }
body.dark .footer a { color: #bbb; }
body.dark .footer a:hover { color: #fff; }

/* Main Content */
.container {
  padding: 80px 20px;
  max-width: 800px;
  margin: auto;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  border-radius: 4px;
}
body.dark .container {
  background: #1e1e1e;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* Blog Post Content */
#post-content h1, #post-content h2, #post-content h3 {
  margin-top: 1.2em;
  color: inherit;
}
#post-content p { margin: 0.6em 0; }

/* Inline code */
#post-content p code,
#post-content li code,
#post-content span code {
  background: #f4f4f4;
  color: #222;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: monospace;
}
body.dark #post-content p code,
body.dark #post-content li code,
body.dark #post-content span code {
  background: #2d2d2d;
  color: #f8f8f2;
}

/* Code blocks */
#post-content pre {
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.95em;
  line-height: 1.4;
}
#post-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-family: monospace;
}

/* Tables */
#post-content table,
.info-table {
  border-collapse: collapse;
  margin: 1em 0;
  width: 100%;
}
#post-content th, #post-content td,
.info-table th, .info-table td {
  border: 1px solid #ccc;
  padding: 8px 12px;
  text-align: left;
}
#post-content th { background: #f2f2f2; }
body.dark #post-content th,
body.dark .info-table th { background: #222; border-color: #555; }
body.dark #post-content td,
body.dark .info-table td { border-color: #555; }

/* Blockquotes */
#post-content blockquote {
  border-left: 4px solid #888;
  margin: 1em 0;
  padding: 0.5em 1em;
  color: #555;
  background: #f9f9f9;
}
body.dark #post-content blockquote {
  border-left-color: #aaa;
  background: #1a1a1a;
  color: #ccc;
}

/* Sponsor buttons */
.sponsor-buttons { display: flex; gap: 15px; margin: 20px 0; }
.sponsor-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: bold;
  color: #fff;
  text-decoration: none;
}
.sponsor-btn.github { background: #24292f; }
.sponsor-btn.bmc { background: #FF813F; }
.sponsor-btn.ko-fi { background: #29abe0; }
.sponsor-btn.liberapay { background: #f6c915; color: #222; }
.sponsor-btn.paypal { background: #0070ba; }

/* Sponsor list */
.sponsor-list {
  margin: 20px 0;
  padding: 15px;
  background: #f2f2f2;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.sponsor-list ul { list-style: none; padding: 0; }
.sponsor-list li { margin: 8px 0; }
body.dark .sponsor-list {
  background: #1e1e1e;
  color: #ddd;
}

/* About Me */
.profile-pic { width: 150px; border-radius: 50%; margin-bottom: 20px; }
.timeline { list-style: none; padding-left: 0; }
.timeline li { margin: 10px 0; }

/* Footer */
.footer {
  text-align: center;
  padding: 20px;
  background: #222;
  color: #fff;
  margin-top: 40px;
}
.footer a { color: #aaa; text-decoration: none; margin: 0 8px; }
.footer a:hover { color: #fff; text-decoration: underline; }

/* === Visitor Info Specific === */
.toolbar { display:flex; gap:8px; flex-wrap:wrap; margin:0 0 12px 0; align-items:center; }
.toolbar button, .copy-btn {
  padding:6px 12px;
  cursor:pointer;
  border:1px solid #888;
  background:#f4f4f4;
  border-radius:4px;
}
.toolbar button:hover, .copy-btn:hover { background:#e0e0e0; }
body.dark .toolbar button,
body.dark .copy-btn { background:#2a2a2a; border:1px solid #555; color:#ddd; }
body.dark .toolbar button:hover,
body.dark .copy-btn:hover { background:#3a3a3a; }

.info-section { margin-bottom:10px; border:1px solid #ddd; border-radius:6px; overflow:hidden; }
.info-header { background:#eee; padding:8px 12px; cursor:pointer; display:flex; justify-content:space-between; align-items:center; }
body.dark .info-header { background:#222; }
.info-header h2 { margin:0; font-size:1.05rem; }
.toggle { font-size:0.9rem; color:#333; }
body.dark .toggle { color:#bbb; }
.copy-btn { font-size:0.8rem; padding:2px 6px; margin-left:6px; }

.collapsed .info-content { display:none; }

pre.raw {
  white-space:pre-wrap;
  word-wrap:break-word;
  background:#f4f4f4;
  padding:10px;
  border-radius:4px;
  max-height:420px;
  overflow:auto;
}
body.dark pre.raw { background:#2d2d2d; color:#f8f8f2; }

.note { font-size:0.95rem; color:#555; margin:8px 0 12px; }
body.dark .note { color:#bbb; }
.muted { color:#777; font-size:0.9rem; }
body.dark .muted { color:#aaa; }

.badge {
  display:inline-block;
  padding:2px 8px;
  border:1px solid #ccc;
  border-radius:999px;
  font-size:0.8rem;
  color:#555;
}
body.dark .badge { border-color:#555; color:#bbb; }

/* Highlights */
.highlight-timeout { color:#e74c3c; font-weight:600; }
.highlight-unavail { color:#c0392b; }
.highlight-empty { color:#777; }
body.dark .highlight-empty { color:#999; }
