
/* Fonts (Source Serif 4, Inter, Exo 2, JetBrains Mono) are loaded by a <link> from
   html_css_files in conf.py, which avoids the render-blocking @import. */

:root {
    /* Body text is a book-style serif, like old computer magazines; the UI
       (nav, sidebars, tags, buttons) stays sans via --font-ui below. */
    --pst-font-family-base: "Source Serif 4", Georgia, "Times New Roman", serif;
    --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --pst-font-family-heading: "Exo 2", "Inter", system-ui, sans-serif;
    --pst-font-family-monospace: "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;

    /* Palette: the pastel rainbow stripes of the logo (and an Apple II),
       plus a phosphor-green accent. */
    --retro-red: #ff9999;
    --retro-yellow: #ffff99;
    --retro-green: #99ff99;
    --retro-cyan: #99ffff;
    --retro-stripes: linear-gradient(to right,
        var(--retro-red), var(--retro-yellow), var(--retro-green), var(--retro-cyan));
    --card-radius: 12px;
}

html[data-theme="light"] {
    --pst-color-primary: #2f55d4;
    --pst-color-link: #2f55d4;
    --pst-color-link-hover: #1a8f4a;
    --card-bg: #ffffff;
    --card-border: #dde1ea;
    --card-shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 4px 14px rgba(20, 30, 60, .06);
    --code-bg: #14181f;
}

html[data-theme="dark"] {
    --pst-color-primary: #7da2ff;
    --pst-color-link: #7da2ff;
    --pst-color-link-hover: #5dffa0;
    --card-bg: #1b1f27;
    --card-border: #2c323d;
    --card-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .35);
    --code-bg: #0c0f14;
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}

body {
  -moz-osx-font-smoothing: grayscale;
}


/* Bio area */
div.profile-pic {
    margin-top: 1em;
}

div.profile-pic img {
    border-radius: 500px;
    width: 80%;
    max-width: 190px;
    margin: 0 auto;
    display: block;
}

.bio-info {
    margin: 1em auto;
    max-width: 220px;
}

.name {
    font-size: 1.5em;
}

.focusareas {
    font-size: .9em;
    font-weight: bold;
}

.whatido {
    margin-top: 1em;
}


/* Sidebar for blog archive / each post */
ul.ablog-archive {
    padding-left: 0px;
}

.bd-sidebar h2 {
    font-size: 1.4em;
}

.bd-sidebar ul {
    padding-left: 0;
    list-style-type: none;
}

.bd-sidebar li {
    padding-bottom: .5em;
}

div.bd-sidebar h3, div.bd-sidebar h2, div.bd-sidebar ul {
    padding-left: 5%;
}

/* In-page post lists */
ul.postlist {
    padding-left: 0;
}

ul.postlist > li > p:first-child {
    font-size: 1.5em;
}

ul.postlist li + li {
    margin-top: 2em;
}

ul.postlist li > p > a {
    font-style: normal;
    font-size: 1.3em;
}


/* Timeline CSS */
div.timeline div.card {
    border: 0px;
}

div.timeline div.left {
    text-align: right;
    border-right: 1px solid black;
}

div.timeline div.entry::after {
    width: 1em;
    height: 1em;
    background: white;
    border-radius: 50%;
    content: "";
    top: 1em;
    display: block;
    position: absolute;
    border: 1px black solid;
    z-index: 999;
}

div.timeline div.entry.left::after {
    right: -.5em;
}

div.timeline div.entry.right::after {
    left: -.5em;
}

/* a dark pill shaped bakground */
div.navbar-logo {
    background: #666;
    border-radius: 1em;
    padding: 0.5em;
    margin-right: 0.5em;
}

.logo-gradient {
  background: linear-gradient(to right, #ff9999, #ffff99, #99ff99, #99ffff);
  background-clip: text;
  -webkit-background-clip: text;
  color:rgba(0,0,0,0) !important;
  text-shadow: none !important;
}

div.footer-item {
  float: right;
}

#navbar-icon-links i.fa-github-square:before {
    color: #999;
}

.table td {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}



/* ==========================================================================
   Modern / retro glow-up
   ========================================================================== */

/* Rainbow stripe across the very top of every page */
body::before {
    content: "";
    display: block;
    height: 4px;
    background: var(--retro-stripes);
}

/* Headings: smooth geometric face, tight tracking */
h1, h2, h3, h4 {
    font-family: var(--pst-font-family-heading);
    letter-spacing: -0.01em;
}

h1 {
    font-weight: 700;
}

/* Short stripe under h1, a nod to the logo */
article.bd-article h1::after {
    content: "";
    display: block;
    width: 64px;
    height: 4px;
    margin-top: .4em;
    border-radius: 2px;
    background: var(--retro-stripes);
}

/* Comfortable reading column and rhythm for posts */
article.bd-article {
    font-size: 1.15rem;   /* serifs read small at the same nominal size */
    line-height: 1.7;
}

article.bd-article p,
article.bd-article li {
    max-width: 72ch;
}

article.bd-article img {
    border-radius: 8px;
    max-width: 100%;
    height: auto;
}

/* Screenshots of 8-bit output look better with hard pixel edges */
article.bd-article img[src*="screenshot"],
article.bd-article img.pixelated {
    image-rendering: pixelated;
}

/* Code: terminal-style blocks, in both light and dark mode */
div.highlight pre,
pre {
    border-radius: 10px;
    font-size: .88em;
    line-height: 1.55;
}

div.highlight {
    border-radius: 10px;
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--retro-green);
    background: var(--code-bg) !important;
    box-shadow: var(--card-shadow);
}

div.highlight pre {
    background: transparent !important;
    color: #e6e9ef;
}

html[data-theme="light"] div.highlight .c,
html[data-theme="light"] div.highlight .c1,
html[data-theme="light"] div.highlight .cm {
    color: #8b95a7;
}

/* Inline code as a soft chip */
code.literal {
    border-radius: 6px;
    padding: .1em .35em;
}

/* Blockquotes / admonitions: rounded, softer */
.admonition, div.admonition {
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}

/* Post list -> cards -------------------------------------------------- */

ul.postlist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

ul.postlist li.ablog-post {
    margin: 0 !important;      /* cancels the "li + li" spacing above */
    padding: 0;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

ul.postlist li.ablog-post:hover {
    transform: translateY(-3px);
    border-color: var(--pst-color-primary);
}

/* Title line: the date is wrapped in .post-date by post-cards.js */
ul.postlist li.ablog-post > p.ablog-post-title {
    order: 2;
    margin: 0;
    padding: 1rem 1.25rem .25rem;
    font-size: 1rem;
}

ul.postlist li.ablog-post > p.ablog-post-title > a {
    display: block;
    font-family: var(--pst-font-family-heading);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
    color: var(--pst-color-text-base);
}

ul.postlist li.ablog-post > p.ablog-post-title > a:hover {
    color: var(--pst-color-link-hover);
}

.post-date {
    display: block;
    margin-bottom: .35rem;
    font-family: var(--pst-font-family-monospace);
    font-size: .75rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--pst-color-text-muted);
}

/* Excerpts: first image becomes the card thumbnail, text is clamped */
ul.postlist li.ablog-post > p.ablog-post-excerpt {
    order: 3;
    margin: 0;
    padding: .25rem 1.25rem;
    font-size: .95rem;
    color: var(--pst-color-text-muted);
}

ul.postlist li.ablog-post > p.ablog-post-excerpt:last-child {
    padding-bottom: 1.25rem;
}

ul.postlist li.ablog-post > p.ablog-post-excerpt:has(> img:only-child) {
    order: 1;
    padding: 0;
}

ul.postlist li.ablog-post > p.ablog-post-excerpt > img:only-child {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 0;
    margin: 0;
}

/* Only show the first couple of text excerpts so cards stay a similar size */
ul.postlist li.ablog-post > p.ablog-post-excerpt:not(:has(> img)) ~ p.ablog-post-excerpt:not(:has(> img)) {
    display: none;
}

/* Landing-page hero --------------------------------------------------- */

.hero {
    margin: 0 0 2.5rem;
    padding: 2.5rem 2rem;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    background:
        linear-gradient(135deg, rgba(153,255,153,.10), rgba(153,255,255,.10) 50%, rgba(255,153,153,.10)),
        var(--card-bg);
    box-shadow: var(--card-shadow);
}

.hero h2 {
    margin: 0 0 .5rem;
    font-size: 2.1rem;
    border: 0;
}

.hero p {
    max-width: 56ch;
    margin: 0 0 1.25rem;
    font-size: 1.1rem;
    color: var(--pst-color-text-muted);
}

.hero .hero-buttons a {
    display: inline-block;
    margin: 0 .5rem .5rem 0;
    padding: .6rem 1.2rem;
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid var(--pst-color-primary);
    transition: transform .12s ease, background .12s ease;
}

.hero .hero-buttons a.primary {
    background: var(--pst-color-primary);
    color: #fff;
}

html[data-theme="dark"] .hero .hero-buttons a.primary {
    color: #0c0f14;
}

.hero .hero-buttons a:hover {
    transform: translateY(-2px);
}

/* Header polish: translucent, blurred, hairline instead of a heavy shadow */
.bd-header {
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    box-shadow: none !important;
    border-bottom: 1px solid var(--card-border);
}


/* Blog archive page (/blog, tag and author pages) ---------------------------
   ablog renders these as div.section.ablog-post blocks (title, metadata list,
   excerpt, "Read more"), not as a postlist, so they get their own card rules. */

div.ablog__collection > div.section.ablog-post {
    margin: 0 0 1.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    transition: transform .15s ease, border-color .15s ease;
}

div.ablog__collection > div.section.ablog-post:hover {
    transform: translateY(-2px);
    border-color: var(--pst-color-primary);
}

div.ablog__collection h2.ablog-post-title {
    margin: 0 0 .4rem;
    font-size: 1.6rem;
    border: 0;
}

div.ablog__collection h2.ablog-post-title a {
    text-decoration: none;
    color: var(--pst-color-text-base);
}

div.ablog__collection h2.ablog-post-title a:hover {
    color: var(--pst-color-link-hover);
}

/* Date / author / tags as one muted row of small items */
div.ablog__collection ul.ablog-archive,
div.ablog__collection .ablog__postcard2 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem 1rem;
    margin: 0 0 .75rem;
    padding: 0;
    font-size: .8rem;
    color: var(--pst-color-text-muted);
}

div.ablog__collection ul.ablog-archive li {
    float: none;
    margin: 0;
    padding: 0;
    font-size: inherit;
}

div.ablog__collection ul.ablog-archive li a {
    margin-right: .25rem;
    padding: .05rem .55rem;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    text-decoration: none;
}

/* Excerpt images: wide banner instead of full-size screenshot */
div.ablog__collection p.ablog-post-excerpt img {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    margin: .5rem 0;
}

div.ablog__collection p.ablog-post-expand {
    margin: .75rem 0 0;
}

div.ablog__collection p.ablog-post-expand a {
    font-weight: 600;
    text-decoration: none;
}

div.ablog__collection p.ablog-post-expand a em {
    font-style: normal;
}

div.ablog__collection div.ablog-post > hr {
    display: none;
}


/* Blog sidebar: tag cloud and archives -------------------------------------- */

.ablog-sidebar-item h3 {
    margin: 1.5rem 0 .75rem;
    padding-left: 5%;
    font-family: var(--pst-font-family-monospace);
    font-size: .75rem;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.ablog-sidebar-item h3 a {
    color: var(--pst-color-text-muted);
    text-decoration: none;
}

.ablog-sidebar-item h3 a:hover {
    color: var(--pst-color-link-hover);
}

/* Tag cloud and archives share one look: wrapping pills.  ablog's cloud-N
   classes still scale the tag size; the archive list is one pill per year. */
.bd-sidebar ul.ablog-cloud,
.bd-sidebar .ablog__archive ul {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .35rem;
    margin: 0;
    padding: 0 5%;
    overflow: visible;
    list-style: none;
}

.bd-sidebar ul.ablog-cloud li.ablog-cloud,
.bd-sidebar .ablog__archive li {
    float: none;
    height: auto;
    margin: 0;
    padding: 0;
    line-height: 1;
}

ul.ablog-cloud a,
.ablog__archive li a {
    display: inline-block;
    padding: .25rem .65rem;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: var(--card-bg);
    text-decoration: none;
    color: var(--pst-color-text-base);
    transition: border-color .12s ease, color .12s ease, background .12s ease;
}

ul.ablog-cloud a:hover,
.ablog__archive li a:hover {
    border-color: var(--pst-color-primary);
    color: var(--pst-color-link-hover);
}


/* UI chrome stays sans-serif; only article text is serif -------------------- */
.bd-header, .bd-sidebar, .bd-footer, .bd-footer-article, .bd-breadcrumbs,
.bd-toc, .search-button__wrapper, .hero .hero-buttons a, .post-date,
ul.ablog-cloud a, .ablog__archive li a, ul.ablog-archive,
div.ablog__collection p.ablog-post-expand,
ul.postlist li.ablog-post > p.ablog-post-excerpt.meta {
    font-family: var(--font-ui);
}

/* Serif italics and bold look best at book weights */
article.bd-article strong { font-weight: 600; }

/* Top toolbar (and its copy in the mobile sidebar) uses the site's original
   Exo 2.  Placed after the --font-ui rule above so it wins.  Only weights 500
   and 700 are loaded, so nav links use 500. */
.bd-header, .bd-header .nav-link, .bd-header .search-button,
.sidebar-header-items, .sidebar-header-items .nav-link {
    font-family: "Exo 2", var(--font-ui);
    font-weight: 500;
}


/* ==========================================================================
   Post pages: one centered column, article-style
   --------------------------------------------------------------------------
   Posts drop the docs sidebars (see html_sidebars in conf.py) and get a
   header/footer rendered by _templates/ablog/post*.html.  Every rule below is
   scoped to pages that have that header, so /docs/** is untouched.
   ========================================================================== */

:root {
    --post-measure: 44rem;   /* the reading column (~700px) */
    --post-wide: 56rem;      /* images and code may break out wider (~900px) */
}

/* Header and footer sit inside <article class="bd-article">, which is widened
   below.  The header stays on the body measure; the footer gets the wide
   column so the prev/next cards have room, with the author card re-centered
   on the measure. */
.post-header,
.post-footer {
    margin-left: auto;
    margin-right: auto;
    font-family: var(--font-ui);
}

.post-header {
    max-width: var(--post-measure);
    margin-top: 1rem;
    margin-bottom: 2.5rem;
}

.post-footer {
    max-width: var(--post-wide);
}

.post-back {
    display: inline-block;
    margin-bottom: 1.25rem;
    font-size: .85rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--pst-color-text-muted);
}

.post-back:hover {
    color: var(--pst-color-link-hover);
}

.post-title {
    margin: 0 0 1.5rem;
    font-family: var(--pst-font-family-heading);
    font-size: clamp(2rem, 4.5vw, 2.9rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -.02em;
}

.post-byline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.post-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    margin: 0;
    object-fit: cover;
    flex: 0 0 auto;
}

.post-byline-main {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}

.post-author {
    font-weight: 600;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .75rem;
    font-size: .85rem;
    color: var(--pst-color-text-muted);
}

/* small dot between the date and the reading time */
.post-meta > * + *::before {
    content: "·";
    margin-right: .75rem;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin: 0 0 0 auto;
    padding: 0;
    list-style: none;
}

.post-tags a {
    display: inline-block;
    padding: .1rem .65rem;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    font-size: .78rem;
    text-decoration: none;
    color: var(--pst-color-text-muted);
}

.post-tags a:hover {
    border-color: var(--pst-color-primary);
    color: var(--pst-color-link-hover);
}

/* Hide the duplicated title and the docs breadcrumb on post pages.  The
   header's own <h1 class="post-title"> is also the first h1 of its parent, so
   it has to be excluded or the post ends up with no headline at all. */
body:has(.post-header) article.bd-article h1:first-of-type:not(.post-title),
body:has(.post-header) .bd-header-article {
    display: none;
}

/* The article gets the wide column; prose is re-centered on the measure so
   images and code can use the full width. */
body:has(.post-header) article.bd-article {
    max-width: var(--post-wide);
    margin-left: auto;
    margin-right: auto;
    font-size: 1.2rem;
    line-height: 1.75;
}

body:has(.post-header) article.bd-article
    :is(p, ul, ol, h2, h3, h4, h5, blockquote, dl, div.highlight, table, .admonition) {
    max-width: var(--post-measure);
    margin-left: auto;
    margin-right: auto;
}

/* A paragraph that holds nothing but an image is a figure: let it bleed. */
body:has(.post-header) article.bd-article :is(p:has(> img:only-child), figure) {
    max-width: var(--post-wide);
    margin-left: auto;
    margin-right: auto;
}

body:has(.post-header) article.bd-article :is(p, ul, ol) {
    /* Books set these with no indent; the measure does the work. */
    text-wrap: pretty;
}

body:has(.post-header) article.bd-article h2 {
    margin-top: 3rem;
    margin-bottom: .75rem;
    font-size: 1.6rem;
}

body:has(.post-header) article.bd-article h3 {
    margin-top: 2.25rem;
    margin-bottom: .5rem;
    font-size: 1.25rem;
}

/* Links: Substack keeps body links quiet until you hover or focus. */
body:has(.post-header) article.bd-article p a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
}

body:has(.post-header) article.bd-article p a:hover {
    text-decoration-color: currentColor;
}

/* Reading progress bar, created by post-cards.js */
.post-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1100;
    width: 100%;
    height: 3px;
    background: var(--pst-color-primary);
    transform: scaleX(0);
    transform-origin: 0 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

/* Prev/next as two cards rather than a line of arrows */
.post-footer .ablog__prev-next {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    max-width: var(--post-wide);
    margin: 0 auto;
}

.post-footer .ablog__prev-next .ablog__spacer,
.post-footer .ablog__prev-next i {
    display: none;
}

.post-footer .ablog__prev-next > span {
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* the theme caps these at max-width:45%; the grid cell is the cap here */
    max-width: none;
    margin-left: 0;
    gap: .4rem;
    min-height: 5.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    background: var(--card-bg);
    font-size: 1rem;
    line-height: 1.4;
    transition: border-color .15s ease, transform .15s ease;
}

.post-footer .ablog__prev-next > span:not(:has(a)) {
    display: none;
}

.post-footer .ablog__prev-next > span:hover {
    transform: translateY(-2px);
    border-color: var(--pst-color-primary);
}

.post-footer .ablog__prev-next > span::before {
    font-size: .72rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pst-color-text-muted);
}

.post-footer .ablog__prev-next .ablog__prev::before {
    content: "← Previous post";
}

.post-footer .ablog__prev-next .ablog__next::before {
    content: "Next post →";
}

.post-footer .ablog__prev-next .ablog__next {
    align-items: flex-end;
    text-align: right;
}

.post-footer .ablog__prev-next a {
    text-decoration: none;
    font-weight: 600;
    color: var(--pst-color-text-base);
}

.post-footer .ablog__prev-next a:hover {
    color: var(--pst-color-link-hover);
}

/* Author card at the end of a post */
.post-author-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    max-width: var(--post-measure);
    margin: 2rem auto 0;
    padding: 1.25rem;
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
}

.post-author-card .post-avatar {
    width: 56px;
    height: 56px;
}

.post-author-card-text strong {
    display: block;
    font-size: 1.05rem;
}

.post-author-card-text p {
    margin: .25rem 0 0;
    font-size: .95rem;
    line-height: 1.5;
    color: var(--pst-color-text-muted);
}

@media (max-width: 767px) {
    body:has(.post-header) article.bd-article {
        font-size: 1.1rem;
    }

    .post-tags {
        margin-left: 0;
    }

    .post-footer .ablog__prev-next {
        grid-template-columns: 1fr;
    }

    .post-footer .ablog__prev-next .ablog__next {
        align-items: flex-start;
        text-align: left;
    }
}
