:root {
    /* --- Light Mode (Paper-like) --- */
    --bg: #faf9f6;          /* "Off-white" / Alabaster - softer than pure white */
    --text: #2c2c2c;        /* Dark Grey - softer than pure black */
    --link: #0044cc;        /* Standard accessible blue */
    --header-text: #111111;
    --meta: #666666;
    --code-bg: #f0f0f0;
    --border: #dddddd;
}

[data-theme="dark"] {
    /* --- Dark Mode (Warm & Soft) --- */
    --bg: #1a1a1a;          /* "Jet" - Soft charcoal, not pure black */
    --text: #e6e0d4;        /* "Bone" - Warm, sepia-tinted off-white */
    --link: #8ab4f8;        /* Softer blue for dark backgrounds */
    --header-text: #f0ebe5; /* Slightly brighter than body text for contrast */
    --meta: #a8a095;        /* Warm grey for timestamps */
    --code-bg: #2a2a2a;     /* Slightly lighter grey for code blocks */
    --border: #444444;
}

/* Reset & Basics */
*, *::before, *::after { box-sizing: border-box; }

body {
    background-color: var(--bg);
    color: var(--text);
    /* System fonts are great, but let's boost the size */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1.2rem;     /* Larger, clearer text (~19px) */
    line-height: 1.7;      /* More breathing room between lines */
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout Strategy: Narrow text column centered */
main, header {
    max-width: 44rem; 
    margin: 0 auto;
    padding: 0 1rem 1rem 1rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--text); /* Solid line matching text color */
    padding-bottom: 1rem;
    margin-top: 3rem;      /* More space at top */
    margin-bottom: 1.5rem;
}

header h1 {
    font-size: 1.4rem;     /* Slightly larger header */
    margin: 0;
    font-weight: 700;
    color: var(--header-text);
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Icons & Buttons */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--text);
    display: flex;
    align-items: center;
    opacity: 0.8; /* Slightly muted until hovered */
    transition: opacity 0.2s;
}

.icon-btn:hover {
    opacity: 1;
}

.icon-btn svg {
    width: 26px; /* Slightly larger icons to match new font size */
    height: 26px;
    fill: currentColor;
}

/* Typography & Posts */
h2 { 
    margin-top: 1rem; 
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
    line-height: 1.3;
}

a { color: var(--link); }

.post-meta {
    font-family: monospace;
    color: var(--meta);
    font-size: 0.9rem;      /* Scaled up relative to body */
    margin-bottom: 1.5rem;  /* Space before body text */
    display: block;
}

/* Code Blocks */
pre {
    background: var(--code-bg);
    padding: 1.25rem;
    overflow-x: auto;
    border-radius: 6px;
    font-size: 0.95rem; /* Code often looks huge, rein it in slightly */
    border: 1px solid var(--border);
}

/* Separator between posts on the homepage */
.post-separator {
    margin-top: 4rem;
    border: 0;
    border-top: 1px solid var(--border); /* Uses your theme's border color */
    width: 100%;
}

/* Hide the separator for the very last post */
article:last-child .post-separator {
    display: none;
}

/* Mobile Tweak */
@media (max-width: 600px) {
    header { margin-top: 1.5rem; }
    body { font-size: 1.1rem; } /* Slightly smaller on phones */
}

/* Theme Icon Glows */
/* Sun glow: warm and bright */
[data-theme="light"] #sun-icon {
  filter: drop-shadow(0 0 3px rgba(255, 165, 0, 0.6));
  color: #ff8c00;
}

/* Moon glow: cool and soft */
[data-theme="dark"] #moon-icon {
  filter: drop-shadow(0 0 5px rgba(100, 149, 237, 0.5));
  color: #a5ccff;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-1deg); }
  50% { transform: rotate(1.5deg); }
}

#sun-icon:hover, #moon-icon:hover {
  animation: wiggle 0.3s ease-in-out infinite;
  /* Softens the stroke to look more like ink on paper */
  filter: blur(0.2px);
}