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

:root {
  --bg: #0a0a0a;
  --bg-alt: #111111;
  --bg-surface: #161616;
  --fg: #d4d4d4;
  --fg-dim: #666666;
  --accent: #dc2626;
  --accent-hover: #ef4444;
  --accent-glow: rgba(220, 38, 38, 0.15);
  --accent-dim: #991b1b;
  --green: #4ade80;
  --border: #222222;
  --border-accent: #2a1010;
  --code-bg: #0e0e0e;
  --max-width: 750px;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

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

a:hover {
  color: var(--accent-hover);
  text-shadow: 0 0 8px var(--accent-glow);
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 2px;
  border: 1px solid var(--border);
}

::selection {
  background: var(--accent);
  color: #000;
}

/* === Header === */
.site-header {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg) 100%);
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.site-title:hover {
  color: var(--accent-hover);
  text-shadow: 0 0 12px var(--accent-glow);
}

.site-nav {
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  font-size: 0.85rem;
  color: var(--fg-dim);
  text-transform: lowercase;
  letter-spacing: 0.03em;
  transition: color 0.2s ease;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--accent);
  text-shadow: none;
}

/* === Main Content === */
main {
  flex: 1;
  padding: 2.5rem 0;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--fg);
}

h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.4rem; margin-top: 2rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.15rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }

/* === Post List === */
.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.post-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
  border-left: 2px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.post-item:hover {
  border-left-color: var(--accent);
  background: var(--bg-alt);
}

.post-item-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.post-date {
  font-size: 0.8rem;
  color: var(--fg-dim);
  white-space: nowrap;
  min-width: 5.5rem;
}

.post-type-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  color: var(--fg-dim);
  letter-spacing: 0.05em;
}

.post-type-badge.blog {
  border-color: var(--accent);
  color: var(--accent);
}

.post-type-badge.note {
  border-color: var(--green);
  color: var(--green);
}

.post-item-title {
  font-size: 1rem;
  font-weight: 600;
}

.post-item-title a {
  color: var(--fg);
}

.post-item-title a:hover {
  color: var(--accent);
  text-shadow: none;
}

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

.post-tags a,
.tag {
  font-size: 0.75rem;
  color: var(--fg-dim);
}

.post-tags a::before,
.tag::before {
  content: '#';
  color: var(--accent-dim);
}

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

/* === Single Post === */
.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-title {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--fg) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.post-meta {
  font-size: 0.8rem;
  color: var(--fg-dim);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.5rem;
}

.post-content {
  line-height: 1.8;
}

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.3rem;
}

.post-content li::marker {
  color: var(--accent-dim);
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--fg-dim);
  font-style: italic;
  background: var(--bg-alt);
  padding: 1rem;
  border-radius: 0 4px 4px 0;
}

.post-content img {
  margin: 1.5rem 0;
  display: block;
}

.post-content h2,
.post-content h3 {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}

.post-content strong {
  color: #e5e5e5;
}

/* === Code === */
code {
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  color: var(--accent-hover);
}

pre {
  background: var(--code-bg) !important;
  padding: 1.25rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-dim);
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  border: none;
  color: var(--fg);
}

/* === Back Link === */
.back-link {
  display: inline-block;
  margin-top: 3rem;
  font-size: 0.85rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--border);
  width: 100%;
}

.back-link::before {
  content: '← ';
}

/* === Page (About, etc.) === */
.page-content {
  line-height: 1.8;
}

.page-content p {
  margin-bottom: 1.25rem;
}

/* === Section Header === */
.section-header {
  margin-bottom: 2rem;
}

.section-header h1 {
  background: linear-gradient(135deg, var(--fg) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === Tag Cloud === */
.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tag-list li a {
  font-size: 0.9rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  display: inline-block;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.tag-list li a:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  text-shadow: none;
}

/* === Footer === */
.site-footer {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  margin-top: auto;
  background: linear-gradient(0deg, var(--bg-surface) 0%, var(--bg) 100%);
}

.site-footer p {
  font-size: 0.75rem;
  color: var(--fg-dim);
}

.site-footer a {
  color: var(--fg-dim);
}

.site-footer a:hover {
  color: var(--accent);
  text-shadow: none;
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dim);
}

/* === Responsive === */
@media (max-width: 600px) {
  .site-header .container {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .site-nav {
    gap: 1rem;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }

  .post-item-header {
    flex-direction: column;
    gap: 0.25rem;
  }
}
