@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,600;1,400&family=IBM+Plex+Mono:wght@400;600&display=swap');

/* Light by default; dark follows the visitor's system setting. */
:root {
    color-scheme: light dark;
    --bg: #fcfcfb;
    --text: #1d1d1f;
    --muted: #66666c;
    --rule: #e3e3e0;
    --tint: #f3f3f1;
    --link: #1f55c2;
    --link-hover: #133b8f;
    --second: #b3245b;

    --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
    --page: 720px;
    --gutter: 1.25rem;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121214;
        --text: #e6e6e3;
        --muted: #9d9da3;
        --rule: #2b2b30;
        --tint: #1b1b1f;
        --link: #8cb0ff;
        --link-hover: #b8ceff;
        --second: #f27ba6;
    }
}

/* Older names, still read by the interactive blog posts. */
:root {
    --black: var(--bg);
    --white: var(--text);
    --dkblue: var(--tint);
    --plum: var(--tint);
    --aqua: var(--link);
    --magenta: var(--second);
    --hotmag: var(--link-hover);
}

/* Posts with wide simulations get a wider page. */
body:has(main.post) {
    --page: 980px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}
html {
    -webkit-text-size-adjust: 100%;
}
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.65;
}
h1, h2, h3, h4 {
    margin: 0;
    line-height: 1.25;
    font-weight: 600;
}
p {
    margin: 0 0 1rem;
}
a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}
a:hover {
    color: var(--link-hover);
}
img {
    max-width: 100%;
    height: auto;
    display: block;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Header and footer ---------- */
.site-header,
.site-footer,
main,
#intro,
#projects,
#about,
#blog,
#contact {
    max-width: var(--page);
    margin: 0 auto;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
}
.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    padding-top: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--rule);
}
.site-name {
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}
.site-name:hover {
    color: var(--text);
}
.site-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
}
.site-header nav a {
    color: var(--muted);
    text-decoration: none;
}
.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
    color: var(--text);
}
.site-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    padding-bottom: 3rem;
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 0.9rem;
}
.site-footer p {
    margin: 0 0 0.25rem;
}
.site-footer a {
    color: var(--muted);
}
.site-footer a:hover {
    color: var(--text);
}

/* ---------- Page sections ---------- */
#intro,
#projects,
#about,
#blog,
main.post {
    padding-top: 3rem;
}
#projects > h2,
#about > h2,
#blog > h2 {
    font-size: 1.75rem;
    margin-bottom: 2rem;
}
.section-title {
    font-size: 0.8rem;
    font-family: var(--mono);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 2.75rem 0 1rem;
}

/* Home */
#intro h1 {
    font-size: 2.25rem;
    letter-spacing: -0.01em;
}
#intro .role {
    color: var(--muted);
    font-size: 1.15rem;
    margin: 0.25rem 0 1.75rem;
}
.home-posts {
    list-style: none;
    padding: 0;
    margin: 0;
}
.home-posts li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--rule);
}
.home-posts time {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.85rem;
    white-space: nowrap;
}
#contact {
    padding-top: 0;
}

/* Projects */
#projects article {
    margin-bottom: 4rem;
}
#projects h4 {
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0 0 0.35rem;
}
#projects h3 {
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
}
#projects .text h4:not(:first-child) {
    margin-top: 1.25rem;
}
#projects ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
#projects ul li {
    font-family: var(--mono);
    font-size: 0.8rem;
    padding: 0.1rem 0.55rem;
    border: 1px solid var(--rule);
    border-radius: 4px;
    color: var(--muted);
}
#projects img,
#projects .diagram {
    width: 100%;
    margin-top: 1.5rem;
    border: 1px solid var(--rule);
    border-radius: 8px;
}
#projects .diagram {
    height: auto;
    padding: 1rem;
    background: var(--tint);
    font-family: var(--sans);
}

/* Inline SVG diagrams: drawn with theme colours so they follow light/dark */
.diagram text { text-anchor: middle; fill: var(--text); }
.diagram .d-step { font-family: var(--mono); font-size: 14px; }
.diagram .d-title { font-size: 15px; font-weight: bold; fill: var(--link); }
.diagram .d-small { font-size: 12px; }
.diagram .d-note { font-size: 12px; opacity: 0.75; }
.diagram .d-out { font-size: 13px; font-weight: bold; }
.diagram .d-stage { fill: var(--bg); stroke: var(--link); stroke-width: 1; }
.diagram .d-box { fill: var(--bg); stroke: var(--rule); }
.diagram .d-line { fill: none; stroke: var(--text); stroke-opacity: 0.45; stroke-width: 1.5; }
.diagram .d-dot { fill: var(--second); }
.diagram .d-flow { fill: none; stroke: var(--second); stroke-width: 2.5; }
.diagram .d-arrowhead { fill: var(--second); }

/* About */
#about h3 {
    font-size: 1.1rem;
    margin: 2rem 0 0.5rem;
}
#about .skills-list {
    padding-left: 1.2em;
    margin: 0 0 1rem;
}
#about .skills-list li {
    margin-bottom: 0.35rem;
}

/* Blog */
.post-meta {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--muted);
    margin: 0 0 0.35rem;
}
.post-meta a {
    color: var(--muted);
}
.post-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 2.5rem;
}
.post-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}
.post-card h3 a {
    color: var(--text);
    text-decoration: none;
}
.post-card h3 a:hover {
    color: var(--link);
}
.post-card p {
    margin: 0;
}
.post-tags {
    list-style: none;
    padding: 0;
    margin: 0.6rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.9rem;
    font-size: 0.85rem;
    color: var(--muted);
}
.post-tags li::before {
    content: "#";
    opacity: 0.6;
}
.post-header {
    margin-bottom: 2rem;
}
.post-header h1 {
    font-size: 2.1rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin-bottom: 1rem;
}
.post-header p {
    max-width: 68ch;
}

/* Resume */
.resume-embed {
    display: block;
    width: 100%;
    height: calc(100vh - 6rem);
    margin-top: 1rem;
    border: 1px solid var(--rule);
    border-radius: 8px;
}

@media (max-width: 520px) {
    #intro h1 { font-size: 1.9rem; }
    .post-header h1 { font-size: 1.7rem; }
    .home-posts li { flex-direction: column; gap: 0; }
}
