:root {
    --bg: #1a1a1a;
    --bg-surface: #242424;
    --bg-hover: #2a2a2a;
    --text: #e0e0e0;
    --text-muted: #999;
    --accent: #4a9eff;
    --border: #333;
    --font: 'Ubuntu', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
}

/* Scroll progress */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--accent);
    width: 0%;
    z-index: 1000;
    transition: width 50ms linear;
}

/* Content container */
#content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* Bio */
.bio {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.headshot {
    width: 130px;
    height: 130px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.bio p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 0.4rem;
}

.bio-email {
    font-size: 0.85rem;
    color: var(--accent);
    text-decoration: none;
}

.bio-email:hover {
    text-decoration: underline;
}

/* Landing page */
.landing {
    padding-top: 2rem;
}

.landing h1 {
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--text);
}

.landing .section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin-bottom: 1.25rem;
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.post-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0.85rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    transition: background 150ms, border-color 150ms;
}

a.post-item {
    cursor: pointer;
}

a.post-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.post-item.inert {
    opacity: 0.5;
    cursor: default;
}

.post-item-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.post-item-title {
    font-size: 1rem;
    font-weight: 500;
}

.post-item-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.post-item-date {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Series hierarchy */
.post-item.series-child {
    margin-left: 1.5rem;
}

/* Reader */
.controls {
    position: sticky;
    top: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    margin-bottom: 1.5rem;
    background: var(--bg);
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 150ms;
}

.btn:hover {
    background: var(--bg-hover);
}

.font-controls {
    display: flex;
    gap: 0.4rem;
}

.font-btn {
    min-width: 2.2rem;
    text-align: center;
}

/* Post content */
.post-content {
    font-size: 18px;
    line-height: 1.8;
}

.post-content h1 {
    font-size: 1.8em;
    font-weight: 500;
    margin: 1.5rem 0 1rem;
    line-height: 1.3;
}

.post-content h2 {
    font-size: 1.4em;
    font-weight: 500;
    margin: 2rem 0 0.75rem;
    color: var(--accent);
}

.post-content h3 {
    font-size: 1.15em;
    font-weight: 500;
    margin: 1.5rem 0 0.5rem;
}

.post-content h4 {
    font-size: 1em;
    font-weight: 500;
    margin: 1.25rem 0 0.5rem;
}

.post-content h5 {
    font-size: 0.9em;
    font-weight: 500;
    margin: 1rem 0 0.5rem;
}

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

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

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

.post-content strong {
    font-weight: 500;
}

.post-content em {
    font-style: italic;
}

/* Figures / images */
.post-content figure {
    margin: 1.5rem 0;
    text-align: center;
}

.post-content figure img {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    cursor: pointer;
}

/* Lightbox overlay */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 200ms ease;
}

.lightbox.active {
    opacity: 1;
}

.lightbox img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: 6px;
    cursor: default;
}

.post-content figcaption {
    margin-top: 0.4rem;
    font-size: 0.75em;
    color: #666;
    text-align: center;
}

/* Video */
.post-content video {
    max-width: 100%;
    border-radius: 6px;
    margin: 1.5rem auto;
    display: block;
}

/* YouTube embeds */
.video-embed {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    margin: 1.5rem auto;
    border-radius: 6px;
    overflow: hidden;
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Tables */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.85em;
    overflow-x: auto;
    display: block;
}

.post-content thead {
    display: table-header-group;
}

.post-content tbody {
    display: table-row-group;
}

.post-content tr {
    display: table-row;
}

.post-content th,
.post-content td {
    display: table-cell;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.post-content th {
    background: var(--bg-surface);
    font-weight: 500;
}

.post-content tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Details / collapse */
.post-content details {
    margin: 1rem 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.post-content details summary {
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    cursor: pointer;
    font-weight: 500;
    user-select: none;
    list-style: none;
}

.post-content details summary::before {
    content: '\25b6';
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 0.75em;
    transition: transform 200ms;
}

.post-content details[open] summary::before {
    transform: rotate(90deg);
}

.post-content details summary::-webkit-details-marker {
    display: none;
}

.post-content .collapse-body {
    padding: 0.75rem 1rem;
}

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

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

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

/* Blockquotes */
.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    color: var(--text-muted);
    background: var(--bg-surface);
    border-radius: 0 4px 4px 0;
}

/* Code */
.post-content code {
    font-family: 'Ubuntu Mono', monospace;
    background: var(--bg-surface);
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    font-size: 0.9em;
}

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

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

/* Responsive */
@media (max-width: 600px) {
    #content {
        padding: 1rem 1rem 3rem;
    }

    .bio {
        flex-direction: column;
        text-align: center;
    }

    .landing h1 {
        font-size: 1.5rem;
    }

    .post-content {
        font-size: 16px;
    }

    .post-content table {
        font-size: 0.75em;
    }
}
