/* --- THEME VARIABLES --- */
:root {
    /* Light Mode */
    --background-color: #f4f4f0;
    --text-color: #1a1a1a;
    --secondary-color: #555555;
    --accent-color: #1a1a1a;
    --border-color: #1a1a1a;
    --hover-bg: #e5e5e0;
    --font-main: 'Inter', sans-serif;
}

[data-theme="dark"] {
    /* Dark Mode */
    --background-color: #000000;
    --text-color: #E8E6E3;
    --secondary-color: #9ca3af;
    --accent-color: #4E9F3D;
    --border-color: #333333;
    --hover-bg: #111111;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: var(--font-main);
    line-height: 1.45;
    font-size: 0.95rem;
    max-width: 800px;
    margin: 0 auto;
    /* Safe area padding for mobile notches */
    padding: 3rem 1.5rem;
    padding-top: calc(3rem + env(safe-area-inset-top));
    transition: background-color 0s, color 0s;
}

/* --- PROGRESS BAR --- */
#progress-container {
    position: fixed;
    top: env(safe-area-inset-top, 0);
    left: 0;
    width: 100%;
    height: 4px;
    z-index: 9999;
    background: transparent;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* Only show progress container if the body has the 'has-progress' class */
body.reading-mode #progress-container {
    opacity: 1;
}

#progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--accent-color);
    transition: width 0.1s ease-out;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] #progress-container {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] #progress-container {
    background: rgba(255, 255, 255, 0.05);
}

/* --- HEADER & NAV --- */
header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    position: relative;
    border-bottom: 2px solid var(--text-color);
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

h1 a {
    text-decoration: none;
    color: inherit;
}

nav ul {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    padding: 0;
}

nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 400;
    font-size: 0.95rem;
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

nav a:hover,
nav a.active {
    color: var(--accent-color);
    border-bottom: 1px solid var(--accent-color);
}

/* --- THEME TOGGLE --- */
.theme-toggle-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.5rem;
}

.theme-toggle-btn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sun {
    display: none;
}

.icon-moon {
    display: block;
}

[data-theme="dark"] .icon-sun {
    display: block;
}

[data-theme="dark"] .icon-moon {
    display: none;
}

/* --- CONTENT --- */
p {
    margin-bottom: 1.25rem;
}

a {
    color: var(--text-color);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s;
}

[data-theme="dark"] a {
    color: var(--accent-color);
}

[data-theme="dark"] nav a {
    color: var(--text-color);
}

[data-theme="dark"] nav a:hover,
[data-theme="dark"] nav a.active {
    color: var(--accent-color);
}

a:hover {
    background-color: var(--hover-bg);
    text-decoration: none;
}

/* --- LISTS --- */
.info-list {
    list-style: none;
    padding: 0;
}

.info-list li {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.info-list p:last-of-type {
    margin-bottom: 0;
}

.info-label {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    opacity: 0.8;
    border-bottom: 1px solid var(--border-color);
    display: inline-block;
    width: fit-content;
    color: var(--accent-color);
}

/* --- BLOG LIST --- */
.writings-intro {
    margin-bottom: 2rem;
    font-style: italic;
    opacity: 0.9;
}

.blog-list {
    display: flex;
    flex-direction: column;
    border-top: 2px solid var(--text-color);
}

.blog-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
}

.blog-item:hover {
    background-color: var(--hover-bg);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.blog-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
}

.blog-item:hover .blog-title {
    color: var(--accent-color);
}

.blog-date {
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-left: 1rem;
}

/* --- FULL POST --- */
article.full-post-view h2 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    margin-top: 0;
    font-weight: 700;
    color: var(--accent-color);
}

.blog-meta {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    display: block;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    font-size: 0.85rem;
}

.blog-body {
    font-size: 0.95rem;
    line-height: 1.45;
}

.blog-body p {
    margin-bottom: 1.5rem;
}

.blog-back-btn {
    display: inline-block;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
}

.blog-back-btn:hover {
    background-color: var(--hover-bg);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.back-to-top-wrapper {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* --- QUOTES --- */
.quote-block {
    border-left: 3px solid var(--accent-color);
    padding-left: 1.25rem;
    margin: 2rem 0;
    font-style: italic;
}

.quote-author {
    font-style: normal;
    font-size: 0.85rem;
    margin-top: 0.4rem;
    display: block;
    color: var(--secondary-color);
}

.contact-list {
    list-style: none;
}

.contact-list li {
    margin-bottom: 0.5rem;
}

@media (max-width: 600px) {
    h1 {
        font-size: 1.8rem;
    }

    nav ul {
        gap: 1rem;
        font-size: 0.9rem;
    }

    .blog-item {
        flex-direction: column;
        gap: 0.25rem;
    }

    .blog-date {
        margin-left: 0;
    }
}