:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --text-primary: #f0f0f0;
    --text-secondary: #9a9a9a;
    --accent: #d97706;
    --accent-hover: #f59e0b;
    --code-bg: #141414;
    --border: #333333;
}

[data-theme="light"] {
    --bg-primary: #f8f8f8;
    --bg-secondary: #ffffff;
    --text-primary: #1f1f1f;
    --text-secondary: #555555;
    --accent: #b45309;
    --accent-hover: #d97706;
    --code-bg: #f0f0f0;
    --border: #e0e0e0;
}

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

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

header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.05em;
    position: relative;
    display: inline-block;
}

.logo .sep {
    opacity: 0.85;
}

.logo .tld {
    font-weight: 500;
    opacity: 0.9;
}

/* terminal-style block cursor (drawn as a box for Safari reliability) */
.logo::after {
    content: "";
    display: inline-block;
    width: 0.65ch;
    height: 1.0em;
    margin-left: 0.15em;
    transform: translateY(0.07em);

    /* uses currentColor (your accent) but faded */
    background-color: currentColor;
    opacity: 0.35;

    animation: logo-blink 1.25s steps(1, end) infinite;
}

@keyframes logo-blink {
    0%, 49% { visibility: hidden; }
    50%, 100% { visibility: visible; }
}

.logo:hover::after,
.logo:focus-visible::after {
    animation: none;
    visibility: visible;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .logo::after {
        animation: none !important;
        visibility: visible !important;
    }
}

#theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 1rem;
}

#theme-toggle:hover {
    border-color: var(--accent);
}

main {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

.post {
    margin-bottom: 4rem;
    padding-bottom: 4rem;
    border-bottom: 1px solid var(--border);
}

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

.post-header {
    margin-bottom: 1.5rem;
}

.post-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.post-title a {
    color: inherit;
    text-decoration: none;
}

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

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

.post-content {
    font-size: 1.1rem;
    overflow: hidden; /* Contain floated images within post */
}

.post-content h1 { display: none; }

.post-content h2,
.post-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

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

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

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

.post-content code {
    background-color: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.9em;
}

.post-content pre {
    background-color: var(--code-bg);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
}

.post-content pre code {
    padding: 0;
    background: none;
}

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

.post-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 1rem 0;
}

.post-content img.img-right {
    float: right;
    max-width: 50%;
    margin: 0 0 1rem 1.5rem;
}

.post-content img.img-left {
    float: left;
    max-width: 50%;
    margin: 0 1.5rem 1rem 0;
}

.post-content img.img-small {
    max-width: 200px;
}

.post-content img.img-medium {
    max-width: 400px;
}

.post-content .clearfix::after {
    content: "";
    display: table;
    clear: both;
}

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

.loading, .empty, .error {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.error {
    color: var(--accent);
}

.error a {
    color: var(--accent);
}

.back-link {
    margin-top: 2rem;
}

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

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

@media (max-width: 600px) {
    .post-title {
        font-size: 1.5rem;
    }
    
    .post-content {
        font-size: 1rem;
    }
}