/* assets/css/style.css */

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

/* --- Base --- */
:root {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2129;
  --text: #c9d1d9;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-dim: rgba(88, 166, 255, 0.15);
  --border: #30363d;
  --code-bg: #1a1f27;
  --font-mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  --font-sans: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --sidebar-width: 260px;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
}

/* --- Layout --- */
.site-wrapper {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-section {
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.sidebar h2 {
  color: #e6edf3;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.sidebar h3 {
  color: #e6edf3;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar nav a {
  font-size: 0.9rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.sidebar nav a:hover {
  background: var(--accent-dim);
  text-decoration: none;
}

.sidebar p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.sidebar-posts {
  list-style: none;
}

.sidebar-posts li {
  margin-bottom: 0.35rem;
}

.sidebar-posts a {
  font-size: 0.85rem;
  line-height: 1.4;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  transition: background 0.15s ease;
}

.sidebar-posts a:hover {
  background: var(--accent-dim);
  text-decoration: none;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag-cloud .tag {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.45em;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tag-cloud .tag:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* --- Main content --- */
main {
  flex: 1;
  max-width: 980px;
  width: 100%;
  padding: 3rem 2.5rem;
}

.site-wrapper {
  display: flex;
  min-height: 100vh;
}

.main-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
}

footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  color: #e6edf3;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

h1 {
  font-size: 2rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

h3 { font-size: 1.15rem; }

p {
  margin-bottom: 1.25rem;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* --- Code --- */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.75rem;
}

pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: 0.85rem;
  line-height: 1.7;
}

/* --- Post list (index page) --- */
.post-list {
  list-style: none;
}

.post-list li {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

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

.post-list time {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  margin-bottom: 0.2rem;
}

.post-list a {
  font-size: 1.2rem;
  font-weight: 600;
  color: #e6edf3;
  transition: color 0.15s ease;
}

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

/* --- Post page --- */
article time {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

article h1 {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

.tags {
  margin-bottom: 2.5rem;
}

.tag {
  display: inline-block;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.5em;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-right: 0.4rem;
}

/* --- Lists inside posts --- */
article ul, article ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

article li {
  margin-bottom: 0.4rem;
}

article li strong {
  color: #e6edf3;
}

/* --- Images --- */
img {
  max-width: 100%;
  border-radius: 8px;
}

/* --- Blockquote --- */
blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.25rem;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-radius: 0 6px 6px 0;
  margin: 1.75rem 0;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.75rem;
}

th, td {
  text-align: left;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
}

th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: #e6edf3;
  font-size: 0.9rem;
}

td {
  font-size: 0.95rem;
}

/* --- Tag groups (tags page) --- */
.tag-group {
  margin-bottom: 2.5rem;
}

.tag-group h2 {
  border-bottom: none;
  font-size: 1.2rem;
}

/* --- Related posts --- */
.related-posts {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.related-posts h2 {
  font-size: 1.2rem;
  border-bottom: none;
  margin-top: 0;
}

.related-posts ul {
  list-style: none;
  padding: 0;
}

.related-posts li {
  margin-bottom: 0.6rem;
}

.related-posts time {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  margin-right: 0.75rem;
}

.related-posts a {
  font-weight: 600;
  color: #e6edf3;
  transition: color 0.15s ease;
}

.related-posts a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .site-wrapper {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  main {
    padding: 1.5rem;
  }

  h1 { font-size: 1.5rem; }
  body { font-size: 15px; }
}
