/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-card: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #495057;
  --text-muted: #6c757d;
  --border-color: #e9ecef;
  --accent-color: #1a1a1a;
  --link-color: #0066cc;
  --code-bg: #f4f4f4;

  /* Catppuccin Latte (light mode) syntax highlighting */
  --code-block-bg: #eff1f5;
  --code-block-bg-gradient: linear-gradient(145deg, #eff1f5 0%, #e6e9ef 100%);
  --code-block-border: #ccd0da;
  --code-block-text: #4c4f69;
  --syntax-string: #40a02b;
  --syntax-comment: #9ca0b0;
  --syntax-name: #1e66f5;
  --syntax-number: #fe640b;
  --syntax-operator: #04a5e5;
  --syntax-punctuation: #4c4f69;
  --syntax-error: #d20f39;
  --syntax-diff-add: #40a02b;
  --syntax-diff-del: #d20f39;
  --syntax-selection: #acb0be;
  --syntax-line-number: #9ca0b0;
  --syntax-keyword: #8839ef;
}

body.dark-mode {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d3748;
  --bg-card: #2d3748;
  --text-primary: #e9ecef;
  --text-secondary: #cbd5e0;
  --text-muted: #a0aec0;
  --border-color: #4a5568;
  --accent-color: #4299e1;
  --link-color: #63b3ed;
  --code-bg: #2d3748;

  /* Catppuccin Mocha (dark mode) syntax highlighting */
  --code-block-bg: #1e1e2e;
  --code-block-bg-gradient: linear-gradient(145deg, #1e1e2e 0%, #181825 100%);
  --code-block-border: #313244;
  --code-block-text: #cdd6f4;
  --syntax-string: #a6e3a1;
  --syntax-comment: #6c7086;
  --syntax-name: #89b4fa;
  --syntax-number: #fab387;
  --syntax-operator: #89dceb;
  --syntax-punctuation: #cdd6f4;
  --syntax-error: #f38ba8;
  --syntax-diff-add: #a6e3a1;
  --syntax-diff-del: #f38ba8;
  --syntax-selection: #585b70;
  --syntax-line-number: #6c7086;
  --syntax-keyword: #cba6f7;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  line-height: 1.3;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; margin-top: 2rem; }
h3 { font-size: 1.35rem; margin-top: 1.5rem; }
h4 { font-size: 1.1rem; margin-top: 1.25rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Top Navigation */
.top-nav {
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-nav .container {
  max-width: 1200px;
}

.nav-links {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 400;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  line-height: 1;
}

.theme-toggle:hover {
  background-color: var(--bg-secondary);
}

.theme-toggle-icon {
  display: inline-block;
  transition: filter 0.2s ease;
}

/* Glow effect for sun icon in dark mode */
body.dark-mode .theme-toggle-icon {
  filter: drop-shadow(0 0 4px #fbbf24) drop-shadow(0 0 8px #f59e0b);
}

/* Footer */
footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  text-align: center;
  margin-top: 3rem;
}

footer .container {
  max-width: 1200px;
}

.footer-links {
  margin-bottom: 1rem;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-links .separator {
  color: var(--text-muted);
  margin: 0 0.5rem;
}

footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

/* Home Page */
.home-header {
  background-color: var(--bg-secondary);
  padding: 3rem 0;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.home-header h1 {
  margin-bottom: 0.5rem;
}

.home-header .subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 0;
}

.home-content {
  padding: 2rem 0;
}

.home-content h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

/* Post List */
.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 1rem;
  align-items: baseline;
}

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

.post-list time {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  flex-shrink: 0;
  width: 100px;
}

.post-list a {
  color: var(--text-primary);
  font-weight: 500;
}

.post-list a:hover {
  color: var(--link-color);
}

/* Single Post */
.post-header {
  background-color: var(--bg-secondary);
  padding: 3rem 0;
  border-bottom: 1px solid var(--border-color);
}

.post-header h1 {
  margin-bottom: 1rem;
}

.post-meta {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.post-meta time {
  color: var(--text-muted);
  font-size: 0.9rem;
}

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

.post-tags a {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 3px;
}

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

.post-content {
  padding: 2rem 0;
}


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

.post-content ul, .post-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

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

.post-content blockquote {
  border-left: 3px solid var(--accent-color);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-style: italic;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1.5rem 0;
}

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.post-content th,
.post-content td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.post-content th {
  font-weight: 600;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

.post-content td {
  color: var(--text-secondary);
}

.post-content tr:hover td {
  background-color: var(--bg-secondary);
}

/* Code Blocks */
.post-content code {
  font-family: 'JetBrains Mono', 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-size: 0.875em;
  background-color: var(--code-bg);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.post-content pre {
  background: var(--code-block-bg-gradient);
  color: var(--code-block-text);
  padding: 0;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--code-block-border);
}

.post-content pre code {
  display: block;
  background: none;
  border: none;
  padding: 1.25rem 1.5rem;
  font-size: 0.875rem;
  line-height: 1.7;
}

/* Hugo's highlight wrapper */
.highlight {
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow-x: auto;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Allow wide code blocks to expand into margins on larger screens */
@media (min-width: 1100px) {
  .post-content .highlight.needs-breakout,
  .post-content pre.needs-breakout:not(.highlight pre) {
    --breakout: min(200px, calc((100vw - 800px) / 2 - 2rem));
    margin-left: calc(-1 * var(--breakout));
    margin-right: calc(-1 * var(--breakout));
    max-width: calc(100% + 2 * var(--breakout));
  }
}

.highlight pre {
  margin: 0;
  border-radius: 8px;
  background: var(--code-block-bg-gradient) !important;
  border: 1px solid var(--code-block-border);
}

/* Catppuccin syntax highlighting - respects light/dark mode */
.highlight .chroma .k, .highlight .chroma .kc, .highlight .chroma .kd, .highlight .chroma .kn,
.highlight .chroma .kp, .highlight .chroma .kr, .highlight .chroma .kt { color: var(--syntax-keyword); } /* keywords - purple */
.highlight .chroma .s, .highlight .chroma .s1, .highlight .chroma .s2, .highlight .chroma .sb,
.highlight .chroma .sc, .highlight .chroma .sd, .highlight .chroma .se, .highlight .chroma .sh,
.highlight .chroma .si, .highlight .chroma .sx, .highlight .chroma .sr, .highlight .chroma .sa { color: var(--syntax-string); } /* strings - green */
.highlight .chroma .c, .highlight .chroma .c1, .highlight .chroma .cm, .highlight .chroma .cp,
.highlight .chroma .cs, .highlight .chroma .ch, .highlight .chroma .cpf { color: var(--syntax-comment); font-style: italic; } /* comments */
.highlight .chroma .na, .highlight .chroma .nb, .highlight .chroma .nc,
.highlight .chroma .nd, .highlight .chroma .ne, .highlight .chroma .nf, .highlight .chroma .ni,
.highlight .chroma .nl, .highlight .chroma .nn, .highlight .chroma .no, .highlight .chroma .nt,
.highlight .chroma .nv, .highlight .chroma .nx, .highlight .chroma .bp, .highlight .chroma .vc,
.highlight .chroma .vg, .highlight .chroma .vi, .highlight .chroma .vm { color: var(--syntax-name); } /* names - blue */
.highlight .chroma .m, .highlight .chroma .mf, .highlight .chroma .mh, .highlight .chroma .mi,
.highlight .chroma .mo, .highlight .chroma .mb, .highlight .chroma .il { color: var(--syntax-number); } /* numbers - peach */
.highlight .chroma .o, .highlight .chroma .ow { color: var(--syntax-operator); } /* operators - sky */
.highlight .chroma .p { color: var(--syntax-punctuation); } /* punctuation */
.highlight .chroma .l, .highlight .chroma .ld { color: var(--syntax-number); } /* literals */
.highlight .chroma .err { color: var(--syntax-error); } /* errors - red */
.highlight .chroma .g, .highlight .chroma .gd { color: var(--syntax-diff-del); } /* diff deleted */
.highlight .chroma .gi { color: var(--syntax-diff-add); } /* diff inserted */
.highlight .chroma .gh, .highlight .chroma .gu { color: var(--syntax-name); font-weight: bold; } /* diff headers */

/* Line numbers */
.chroma .ln, .chroma .lnt {
  color: var(--syntax-line-number);
  margin-right: 0.75rem;
  padding-right: 0.75rem;
  border-right: 1px solid var(--code-block-border);
  user-select: none;
}

/* Selection in code blocks */
.chroma ::selection {
  background-color: var(--syntax-selection);
}

/* Section Pages (configs, tags) */
.section-header {
  background-color: var(--bg-secondary);
  padding: 2rem 0;
  border-bottom: 1px solid var(--border-color);
}

.section-header h1 {
  margin-bottom: 0.5rem;
}

.section-header p {
  margin: 0;
}

.section-content {
  padding: 2rem 0;
}

/* Cards (for configs) */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-color);
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.card p {
  margin-bottom: 0;
  font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.4rem; }

  .post-list li {
    flex-direction: column;
    gap: 0.25rem;
  }

  .post-list time {
    width: auto;
  }

  .nav-links {
    gap: 1rem;
    justify-content: center;
  }

  .post-header, .home-header, .section-header {
    padding: 2rem 0;
  }
}

