/* --- Global Styles & Variables --- */
:root {
    --font-family-sans: 'Inter', sans-serif;
    --font-family-mono: 'Source Code Pro', monospace;
}

/* Dawn - warm peachy sunrise */
[data-theme="dawn"] {
    --primary-color: #3d2c29;
    --secondary-color: #7a5f5a;
    --accent-color: #d4726a;
    --background-color: #fff5f0;
    --surface-color: #ffe8dc;
    --border-color: #f0d0c0;
    --code-bg-color: #2d2424;
    --code-text-color: #f8e8e0;
    --inline-code-bg: #f5e0d8;
}

/* Noon - bright daylight (default) */
[data-theme="noon"] {
    --primary-color: #0a0a0a;
    --secondary-color: #5a5a5a;
    --accent-color: #3d7eeb;
    --background-color: #ffffff;
    --surface-color: #f9f9f9;
    --border-color: #eaeaea;
    --code-bg-color: #2d2d2d;
    --code-text-color: #f8f8f2;
    --inline-code-bg: #eef1f5;
}

/* Dusk - warm orange/purple sunset */
[data-theme="dusk"] {
    --primary-color: #2d1f3d;
    --secondary-color: #6b5a7a;
    --accent-color: #e07850;
    --background-color: #faf0eb;
    --surface-color: #f0e0d8;
    --border-color: #dcc8be;
    --code-bg-color: #2d2030;
    --code-text-color: #f0e8f0;
    --inline-code-bg: #ebe0e8;
}

/* Night - dark mode */
[data-theme="night"] {
    --primary-color: #e8e8e8;
    --secondary-color: #a0a0a0;
    --accent-color: #7eb8ff;
    --background-color: #0d1117;
    --surface-color: #161b22;
    --border-color: #30363d;
    --code-bg-color: #1a1a24;
    --code-text-color: #e0e8f0;
    --inline-code-bg: #21262d;
}

body {
    font-family: var(--font-family-sans);
    line-height: 1.7;
    color: var(--primary-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
}

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

.container.container-post {
    padding-top: 0;
}

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

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

h1, h2, h3 {
    font-weight: 700;
    line-height: 1.2;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

/* --- Header & Footer --- */
header {
    position: relative;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    padding-top: 4rem;
    padding-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    margin: 0;
}

header h1 a {
    color: var(--primary-color);
}

header .subtitle {
    font-size: 1.1rem;
    color: var(--secondary-color);
    margin-top: 0.5rem;
}

/* Theme toggle button */
.theme-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

[data-theme="night"] .theme-toggle {
    background: #ffffff;
    border-color: #ffffff;
}

.theme-toggle svg,
.theme-toggle img {
    width: 28px;
    height: 28px;
}

/* Minimal header for post pages (just contains theme toggle) */
.post-page-header {
    position: relative;
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border: none;
}

footer {
    text-align: center;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-color);
    font-size: 0.9rem;
}

/* --- Post List (index.html) --- */
.post-list h2 {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 2rem;
}

.post-preview {
    margin-bottom: 3rem;
}

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

.post-preview h3 a {
    color: var(--primary-color);
}

.post-preview h3 a:hover {
    color: var(--accent-color);
}

.post-meta {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.read-more {
    display: inline-block;
    margin-top: 1rem;
    font-weight: 700;
}

/* --- Full Post (post.html) --- */
.post-full .post-header {
    text-align: center;
    padding-top: 0;
    margin-bottom: 3rem;
}

.post-full h2 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

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

/* --- Code Blocks --- */
pre {
    background-color: var(--code-bg-color);
    color: var(--code-text-color);
    font-family: var(--font-family-mono);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 2rem 0;
}

code {
    font-family: var(--font-family-mono);
}

/* For inline code */
p > code, li > code {
    background-color: var(--inline-code-bg);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 85%;
}

img.content-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.5rem auto 1rem auto;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

img.content-image + small {
    margin-top: 0.5rem;
}

/* --- Water Ripple Effect --- */
.ripple {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent-color) 30%, transparent) 0%, transparent 70%);
    pointer-events: none;
    transform: scale(0);
    animation: ripple-expand 0.6s ease-out forwards;
}

@keyframes ripple-expand {
    to {
        transform: scale(1);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ripple {
        display: none;
    }
}