:root {
  --bg: #1e1e1e;
  --fg: #2a2a2a;
  --text: #eaeaea;
  --muted: #999;
  --accent: #36b37e;
  --card-bg: #2e2e2e;
  --border: #444;
  --shadow: rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: "Inter", system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* Layout area takes available space */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr;
  background-color: var(--fg);
}

/* Sidebar */
.sidebar {
  background: linear-gradient(to bottom, #1b1b1b, #111);
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-right: 1px solid var(--border);
}

.sidebar img {
  width: 120px;
  border-radius: 50%;
  margin-bottom: 1rem;
  border: 3px solid var(--accent);
}

.sidebar-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.sidebar p {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  margin: 0.2rem 0;
}

.sidebar nav {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.sidebar nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  text-align: center;
  width: 100%;
}

.sidebar nav a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Main content */
.content {
  padding: 2rem;
  background-color: var(--fg);
}

.hero {
  background-size: cover;
  background-position: center;
  border-radius: 12px;
  margin-bottom: 2rem;
  height: 180px;
  animation: fadeIn 1s ease-out forwards;
}

/* Links */
a,
a:visited {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  text-decoration: underline;
}

/* Post cards */
.post-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 6px var(--shadow);
  border: 1px solid var(--border);
}

.post-card h2 {
  margin-top: 0;
  font-size: 1.2rem;
  color: var(--accent);
}

.post-card p {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0.5rem 0;
}

.post-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

/* Post list */
.post-list {
  list-style: none;
  padding-left: 0;
  margin-top: 1rem;
}

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

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

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

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

.post-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 1rem;
}

.post-date {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* Tags */
.tag-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-list li {
  margin: 0;
}

.tag {
  display: inline-block;
  background: var(--card-bg);
  color: var(--accent);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.tag:hover {
  background: var(--border);
}

.tag--active,
.tag--active:visited {
  background: var(--accent);
  color: var(--bg);
}

.post-tags-container {
  margin: 1rem 0;
  background: var(--card-bg);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px var(--shadow);
}

.post-tags-container strong {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.post-tags .tag {
  display: inline-block;
  background: var(--fg);
  color: var(--accent);
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  border-radius: 4px;
  text-decoration: none;
  border: 1px solid var(--border);
  transition: background 0.2s ease;
}

.post-tags .tag:hover {
  background: var(--border);
}

/* Sections */
.section {
  background: var(--card-bg);
  padding: 2rem;
  margin-bottom: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 6px var(--shadow);
  border: 1px solid var(--border);
}

.section h2, .section h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: var(--accent);
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.25rem;
}

.section p {
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.6;
}

.about-me,
.tags,
.latest-posts {
  scroll-margin-top: 80px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
  overflow-x: auto;
  display: block;
}

thead {
  background: var(--card-bg);
}

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

th {
  font-weight: 600;
  color: var(--accent);
}

tr:nth-child(even) {
  background: var(--card-bg);
}

/* Code blocks */
pre, code {
  font-family: 'Fira Code', monospace;
}

pre {
  overflow-x: auto;
  overflow-y: hidden;
  white-space: pre;
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 8px;
  background-color: var(--card-bg);
  max-width: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

pre code {
  display: block;
  min-width: max-content;
  opacity: 0;
  transition: opacity 0.8s ease-in;
}

pre code.hljs {
  opacity: 1;
}

pre::-webkit-scrollbar {
  height: 6px;
}

pre::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* Copy button */
.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.copy-button:hover {
  opacity: 1;
}

.copy-button i {
  pointer-events: none;
}

/* Images — CSS-only fade-in, no JS dependency */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

img {
  animation: fadeIn 0.8s ease-out forwards;
}

.section {
  animation: fadeIn 0.6s ease-out both;
}

.section:nth-child(2) { animation-delay: 0.15s; }
.section:nth-child(3) { animation-delay: 0.3s; }

/* Social links */
.social-links {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  justify-content: center;
}

.social-links a i {
  font-size: 1.2rem;
  color: var(--text);
}

.social-links a:hover i {
  color: var(--accent);
}

/* Footer */
footer {
  background: var(--fg);
  border-top: 1px solid var(--border);
  padding: 0.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: auto;
}

footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

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

  .sidebar {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar img {
    width: 80px;
    margin-bottom: 0.5rem;
  }

  .sidebar-name {
    font-size: 1rem;
  }

  .sidebar p {
    font-size: 0.75rem;
  }

  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
  }

  .sidebar nav a {
    width: auto;
  }

  .content {
    padding: 5vw;
  }

  .hero {
    height: 120px;
    border-radius: 8px;
  }

  .post-card {
    padding: 1rem;
  }

  .post-card h2 {
    font-size: 1rem;
  }

  .post-list li {
    font-size: 0.95rem;
  }

  footer {
    font-size: 0.75rem;
    padding: 0.5rem 0.25rem;
  }

  .social-links {
    justify-content: center;
    flex-wrap: wrap;
  }
}
