/* ==========================================================================
   Design System - Personal Tech Blog
   Minimal, content-first. No fluff.
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Variables
   -------------------------------------------------------------------------- */

:root {
  /* Colors - Light mode (default) */
  --bg: #ffffff;
  --bg-secondary: #f8fafc;
  --text: #1a1a2e;
  --text-muted: #64748b;
  --accent: #5B8EC9;
  --accent-hover: #4B7DB5;
  --border: #e2e8f0;
  --code-bg: #f1f5f9;
  --code-text: #1a1a2e;
  --shadow: rgba(0, 0, 0, 0.06);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono',
    Consolas, monospace;
  --font-size-base: 17px;
  --line-height: 1.7;

  /* Spacing */
  --container-max: 720px;
  --container-pad: 1.5rem;
}

/* Dark mode */
.dark {
  --bg: #0f0f1a;
  --bg-secondary: #191928;
  --text: #e8eaed;
  --text-muted: #a0b0c4;
  --accent: #6aadff;
  --accent-hover: #8ec3ff;
  --border: #283040;
  --code-bg: #1a1a2a;
  --code-text: #e8eaed;
  --shadow: rgba(0, 0, 0, 0.3);
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */

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

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  line-height: var(--line-height);
  color: var(--text);
  background-color: var(--bg);
  transition: background-color 0.2s ease, color 0.2s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 600;
  color: var(--text);
}

h1 { font-size: 2rem; margin-bottom: 0.75rem; }
h2 { font-size: 1.5rem; margin-top: 2rem; margin-bottom: 0.6rem; }
h3 { font-size: 1.25rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }

p {
  margin-bottom: 1.25rem;
}

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

a:hover {
  color: var(--accent-hover);
}

strong { font-weight: 600; }

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

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

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

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.nav {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.nav-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-title:hover {
  color: var(--accent);
}

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

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.925rem;
  transition: color 0.15s ease;
}

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

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  color: var(--text-muted);
  transition: color 0.15s ease, background-color 0.15s ease;
  line-height: 1;
}

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

/* --------------------------------------------------------------------------
   Hero Section (Home Page)
   -------------------------------------------------------------------------- */

.hero {
  padding: 3rem 0 1rem;
}

.hero h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.hero .subtitle {
  color: var(--text-muted);
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.hero p {
  max-width: 600px;
}

.hero p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Post List
   -------------------------------------------------------------------------- */

.post-list {
  list-style: none;
  padding: 0;
}

.post-item {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

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

/* --------------------------------------------------------------------------
   Project Cards
   -------------------------------------------------------------------------- */

.project-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-top: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background-color 0.2s ease;
}

.project-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px var(--shadow);
}

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

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

.project-card h3 a:hover {
  color: var(--accent-hover);
}

.project-card .project-date {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.project-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

/* --------------------------------------------------------------------------
   Blog Post Content
   -------------------------------------------------------------------------- */

.post-content {
  margin-top: 2rem;
}

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

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

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

/* Headings inside post */
.post-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.post-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

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

.post-content blockquote p {
  margin-bottom: 0;
}

/* Code - Inline */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background-color: var(--code-bg);
  color: var(--code-text);
  padding: 2px 6px;
  border-radius: 4px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Code - Block */
.post-content pre {
  background-color: var(--code-bg);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--code-text);
}

/* Images */
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem 0;
  display: block;
}

/* Lists */
.post-content ul,
.post-content ol {
  margin: 1rem 0 1.4rem;
  padding-left: 1.5rem;
}

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

.post-content li > ul,
.post-content li > ol {
  margin-top: 0.3rem;
  margin-bottom: 0;
}

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

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

.post-content th {
  background-color: var(--bg-secondary);
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.post-content tbody tr:hover {
  background-color: var(--bg-secondary);
  transition: background-color 0.15s ease;
}

/* --------------------------------------------------------------------------
   Post Header (individual post page)
   -------------------------------------------------------------------------- */

.post-header {
  padding: 3rem 0 1.5rem;
}

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

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  transition: border-color 0.2s ease;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.footer-links .copyright {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   Badge Links (Sponsor / Ko-fi)
   -------------------------------------------------------------------------- */

.badge-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.badge-link:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.badge-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

.badge-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 7px;
}

.badge-sm svg {
  width: 15px;
  height: 15px;
}

.badge-github {
  background-color: #24292e;
  color: #ffffff !important;
}

.badge-github:hover {
  color: #ffffff !important;
}

.badge-kofi {
  background-color: #d5555a;
  color: #ffffff !important;
}

.badge-kofi:hover {
  color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */

.muted  { color: var(--text-muted); }
.mono   { font-family: var(--font-mono); }
.text-sm { font-size: 0.875rem; }

.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  :root {
    --container-pad: 1rem;
    --font-size-base: 16px;
  }

  .hero {
    padding: 2rem 0 0.5rem;
  }

  .hero h1 {
    font-size: 1.65rem;
  }

  h1 { font-size: 1.65rem; }
  h2 { font-size: 1.35rem; }

  .nav .container {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-links {
    gap: 1rem;
    flex-wrap: wrap;
  }

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

  .post-content pre {
    padding: 1rem;
    border-radius: 6px;
  }
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
  .nav,
  .footer,
  .theme-toggle {
    display: none;
  }

  body {
    color: #000;
    background: #fff;
    font-size: 12pt;
    line-height: 1.5;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  .post-content pre {
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }

  .post-content img {
    max-width: 100%;
    page-break-inside: avoid;
  }
}
