:root {
    --bg: #f9f9f9;
    --text: #222;
    --accent: #99aadd;
    --meta: #666;
    --rule: #ddd;
    --code-bg: #eee;
}

[data-theme="dark"] {
    --bg: #111;
    --text: #e8e8e8;
    --accent: #99aadd;
    --meta: #888;
    --rule: #333;
    --code-bg: #222;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    line-height: 1.55;
}

.layout {
    display: flex;
    gap: 2rem;
    max-width: 60rem;
    margin: 4rem auto 2rem;
    padding: 0 1.25rem;
}

.layout aside {
    flex: 0 0 14rem;
    font-size: 0.9rem;
    padding-right: 1rem;
    position: sticky;
    top: 2rem;
    align-self: flex-start;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.layout main {
    flex: 1;
    min-width: 0;
}

main {
    max-width: 38rem;
    margin: 2rem auto;
    padding: 0 1.25rem;
}

.layout main {
    margin: 0;
    padding: 0;
}

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

h1 {
    font-size: 1.6rem;
    margin: 0 0 0.5rem;
}
h2 {
    font-size: 1.2rem;
    margin: 1.5rem 0 1.5rem;
}

.meta {
    color: var(--meta);
    font-size: 0.85rem;
}

.post-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.post-list li {
    padding: 0.2rem 0;
}

.post-list li.current a {
    color: var(--text);
    font-weight: bold;
    text-decoration: none;
}

.postnav {
    margin: 1rem 0 0;
    padding-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--meta);
}

.postnav .disabled {
    color: #bbb;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem 0;
}

article p {
    margin: 0.75rem 0;
}

code {
    background: var(--code-bg);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.9em;
}

pre {
    background: var(--code-bg);
    padding: 0.75rem;
    overflow-x: auto;
}

pre code {
    background: none;
    padding: 0;
}

.preview {
    margin: 0 0 2rem;
    padding-bottom: 1rem;
}
.preview h2 {
    margin: 0 0 0.25rem;
    font-size: 1.15rem;
}
.preview h2 a {
    color: var(--text);
    text-decoration: none;
}
.preview h2 a:hover {
    color: var(--accent);
}
.preview .meta {
    margin: 0 0 0.5rem;
}
.preview .more {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
}
.preview-thumb {
    display: block;
    margin: 0 0 0.75rem;
    overflow: hidden;
    max-height: 14rem;
}
.preview-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: 14rem;
    object-fit: cover;
    margin: 0;
}
.preview-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

aside .brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0 0 1rem;
}
aside .brand {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}
.theme-toggle {
    appearance: none;
    background: transparent;
    border: none;
    color: var(--text);
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: width 0.2s ease, height 0.2s ease;
}
.theme-toggle:hover {
    width: calc(1.6rem + 5px);
    height: calc(1.6rem + 5px);
}
.theme-toggle-icon {
    width: 1rem;
    height: 1rem;
    background-color: var(--text);
    -webkit-mask: url("/assets/IcoLight.svg") center/contain no-repeat;
    mask: url("/assets/IcoLight.svg") center/contain no-repeat;
    transition: width 0.2s ease, height 0.2s ease;
}
.theme-toggle:hover .theme-toggle-icon {
    width: calc(1rem + 5px);
    height: calc(1rem + 5px);
}
[data-theme="dark"] .theme-toggle-icon {
    -webkit-mask-image: url("/assets/IcoDark.svg");
    mask-image: url("/assets/IcoDark.svg");
}

[data-theme="dark"] img[src$="AboutHeader.gif"] {
    filter: invert(1);
}
aside .brand:hover {
    color: var(--accent);
}
aside details {
    margin: 0 0 0.5rem;
}
aside summary {
    cursor: pointer;
    font-weight: bold;
    padding: 0.25rem 0;
    list-style: none;
}
aside summary::-webkit-details-marker {
    display: none;
}
aside summary::before {
    content: "\25B8";
    display: inline-block;
    width: 1rem;
    color: var(--meta);
}
aside details[open] > summary::before {
    content: "\25BE";
}
aside summary a {
    color: var(--text);
    text-decoration: none;
}
aside summary a:hover {
    color: var(--accent);
}
aside ul {
    list-style: none;
    padding: 0 0 0 1rem;
    margin: 0.25rem 0 0.5rem;
}
aside li {
    padding: 0.15rem 0;
    font-size: 0.9rem;
}
aside li.current a {
    color: var(--text);
    font-weight: bold;
    text-decoration: none;
}
aside .nav-link {
    display: block;
    font-weight: bold;
    padding: 0.25rem 0 0.25rem 1rem;
    color: var(--text);
    text-decoration: none;
}
aside .nav-link:hover {
    color: var(--accent);
}
aside .nav-link.current {
    color: var(--text);
}

.recent {
    margin-top: 2rem;
}
.about {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

main.wide {
    max-width: none;
}

.hero {
    margin-bottom: 3.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--rule);
}
.hero h1 {
    max-width: 30rem;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.08;
    letter-spacing: -0.04em;
    margin: 0 0 0.75rem;
}
.hero-kicker {
    color: var(--meta);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 0.8rem;
}
.hero-line {
    font-size: 1.05rem;
    max-width: 34rem;
    margin: 0 0 0.75rem;
}
.hero-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0;
    font-size: 0.9rem;
}

.work-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 1.25rem;
    margin: 1rem 0 2rem;
}
.work-card {
    display: block;
    color: var(--text);
    text-decoration: none;
}
.work-card-thumb {
    display: block;
    aspect-ratio: 16 / 10;
    background: var(--code-bg);
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.work-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
}
.work-card-title {
    display: block;
    font-weight: bold;
}
.work-card:hover .work-card-title {
    color: var(--accent);
}
.work-card-outcome {
    display: block;
    color: var(--meta);
    font-size: 0.85rem;
    margin-top: 0.15rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

article.work {
    max-width: 46rem;
}
.work-outcome {
    font-size: 1.05rem;
    color: var(--meta);
    margin: 0.25rem 0 1rem;
}
.work-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;
    margin: 0 0 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--rule);
    font-size: 0.85rem;
}
.work-meta div {
    min-width: 10rem;
}
.work-meta dt {
    color: var(--meta);
    text-transform: lowercase;
}
.work-meta dd {
    margin: 0;
}

.home-about,
.home-projects,
.work-index {
    margin-bottom: 2.5rem;
}

.recent {
    margin-bottom: 3.5rem;
}

.home-projects,
.work-index,
.home-about {
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
}

.home-section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.home-section-heading p {
    color: var(--meta);
    font-size: 0.85rem;
}

@media (max-width: 720px) {
    .layout {
        flex-direction: column;
        gap: 1rem;
    }
    .layout aside {
        flex: 1 1 auto;
        padding-right: 0;
        padding-bottom: 1rem;
        position: static;
        max-height: none;
    }
}
