/*
 * visgean.me — the only stylesheet. Sections:
 *   1. tokens & reset   2. typography   3. layout (white column on the Trianglify background)
 *   4. header           5. index extras (avatar, activity graph)
 *   6. blog (body.blog: Lora/Playfair/Lato article look, highlight.js theme)
 * Breakpoint: 800px (also where site.js stops drawing the background).
 */

/* 1. tokens & reset ------------------------------------------------------ */

:root {
    --text: #111;
    --muted: #828282;
    --link: #2a7ae2;
    --link-visited: #1756a9;
    --rule: #e8e8e8;
    --bg: #fdfdfd;
    --page-width: 800px;
    /* As before the Oct 2026 rework: Cutive Mono is not served, so this is the browser's
       default monospace (Menlo in Chrome/Firefox on Mac, Courier in Safari, Consolas on Windows). */
    --mono: "Cutive Mono", monospace;
    --heading: "Finlandica", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

@font-face {
    font-family: "Finlandica";
    src: url("/static/fonts/Finlandica-Regular.woff2") format("woff2");
    font-display: swap;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font: 400 20px/normal var(--mono);   /* line-height normal, as before: 1.5 read as a different font */
    color: var(--text);
    background-color: var(--bg);
    -webkit-text-size-adjust: 100%;
    font-kerning: normal;
}

/* 2. typography ---------------------------------------------------------- */

h1, h2, h3, h4, h5, h6,
p, blockquote, pre, ul, ol, dl, figure, hr, table {
    margin: 0 0 15px;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
}

/* Only h1/h2 use Finlandica; h3 and below stay in the body monospace, as before. Sizes are
   the browser defaults the old stylesheet relied on (2em / 1.5em / 1.17em of 20px). */
h1, h2 {
    font-family: var(--heading);
}

h1 { font-size: 40px; }
h2 { font-size: 30px; }
h3 { font-size: 23px; }
h4, h5, h6 { font-size: 20px; }

a {
    color: var(--link);
    text-decoration: none;
}

a:visited {
    color: var(--link-visited);
}

a:hover {
    color: var(--text);
    text-decoration: underline;
}

ul, ol {
    padding-left: 30px;
}

li > ul,
li > ol {
    margin-bottom: 0;
}

img, iframe, video {
    max-width: 100%;
}

img {
    height: auto;
    vertical-align: middle;
}

figure > img {
    display: block;
}

figcaption {
    font-size: 14px;
}

blockquote {
    color: var(--muted);
    border-left: 4px solid var(--rule);
    padding-left: 15px;
    font-size: 18px;
    letter-spacing: -1px;
    font-style: italic;
}

blockquote > :last-child {
    margin-bottom: 0;
}

pre, code {
    font-family: var(--mono);
    font-size: 15px;
    border: 1px solid var(--rule);
    border-radius: 3px;
    background-color: #eef;
}

code {
    padding: 1px 5px;
}

pre {
    padding: 8px 12px;
    overflow-x: auto;
}

pre > code {
    border: 0;
    padding: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 4px 8px;
    text-align: left;
    border-bottom: 1px solid var(--rule);
}

hr {
    border: 0;
    border-top: 1px solid var(--rule);
}

/* 3. layout -------------------------------------------------------------- */

/* One white column, 800px wide, over the body background (Trianglify pattern on wide
   screens, plain --bg below 800px where site.js does not draw it). */
.wrapper {
    max-width: var(--page-width);
    margin: 0 auto;
    padding: 0 30px;
    background: #fff;
    overflow-wrap: anywhere;
}

.page-content .wrapper {
    padding-top: 30px;
    padding-bottom: 30px;
}

@media screen and (max-width: 800px) {
    .wrapper {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* Screenshots in markdown pages: a hairline frame so UI shots do not melt into the page.
   Pages wrap them in a link to the full-size file (see pages/waypoint.md). */
.page-content p > a > img,
.page-content p > img {
    border: 1px solid var(--rule);
    border-radius: 3px;
}

/* 4. header -------------------------------------------------------------- */

.site-header .wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 56px;
    border-bottom: 1px solid var(--rule);
}

.site-title,
.site-title:visited {
    font-size: 26px;
    font-weight: 300;
    line-height: 56px;
    letter-spacing: -1px;
    color: #424242;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-title:hover {
    color: var(--text);
    text-decoration: none;
}

.header-social {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.header-social a,
.header-social a:visited {
    display: inline-flex;
    color: rgba(0, 0, 0, 0.6);
}

.header-social a:hover {
    color: var(--link);
}

.icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* 5. index extras -------------------------------------------------------- */

.avatar {
    display: block;
    width: 200px;
    height: 200px;
    margin: 0 auto 30px;
    border-radius: 50%;
    object-fit: cover;
}

.activity-graph {
    margin-bottom: 30px;
    overflow: hidden;
}

.activity-loading {
    text-align: center;
    color: var(--muted);
    padding: 20px 0;
}

/* The calendar markup is built by static/js/activity-graph.js. */
.activity-calendar {
    display: flex;
    gap: 2px;
    width: 100%;
}

.activity-week {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.activity-day {
    aspect-ratio: 1;
    background: #f5f5f5;
}

.activity-day:hover {
    opacity: 0.8;
}

.activity-day.level-1 { background: #c6e48b; }
.activity-day.level-2 { background: #7bc96f; }
.activity-day.level-3 { background: #449a3e; }
.activity-day.level-4 { background: #2d6a2f; }
.activity-day.level-5 { background: #0a2910; }
.activity-day.future  { background: transparent; }

.activity-tooltip {
    position: fixed;
    display: none;
    z-index: 1000;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-size: 12px;
    pointer-events: none;
}

/* Breathing room above section titles in page content (index and text pages); the first
   element of a page stays flush with the top. */
.page-content h1,
.page-content h2 { margin-top: 48px; }
.page-content h3,
.page-content h4 { margin-top: 32px; }
.page-content .wrapper > :first-child { margin-top: 0; }

/* 5b. text pages (pages/*.md, body.page) --------------------------------- */

/* Reading font for the long pages; the index keeps the monospace. This is what the old,
   never-linked page.css intended (Lora 16px/1.8, #242424). Code stays monospace. */
body.page {
    font: 400 16px/1.8 "Lora", Georgia, serif;
    color: #242424;
}

body.page h1,
body.page h2 {
    color: #242424;
}

body.page h1 { font-size: 40px; }
body.page h2 { font-size: 35px; }
body.page h3 { font-family: var(--heading); font-size: 26px; }

body.page .site-title {
    font-family: var(--mono);
}

/* 5c. multi-page sections (body.section, templates/section.html) --------- */

/* Wider white column with a sticky left navigation; stacks below 800px. */
body.section .wrapper {
    max-width: 1100px;
}

.section-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 40px;
}

.section-nav {
    position: sticky;
    top: 20px;
    align-self: start;
    font: 400 15px/1.4 var(--mono);
}

.section-nav-home,
.section-nav-home:visited {
    display: block;
    margin-bottom: 12px;
    color: #424242;
    font-weight: 700;
}

.section-nav ol {
    margin: 0;
    padding: 0;
    list-style: none;
    border-left: 1px solid var(--rule);
}

.section-nav li a,
.section-nav li a:visited {
    display: block;
    padding: 6px 0 6px 12px;
    margin-left: -1px;
    border-left: 2px solid transparent;
    color: var(--muted);
}

.section-nav li a:hover {
    color: var(--text);
    text-decoration: none;
}

.section-nav li a[aria-current="page"] {
    color: var(--text);
    border-left-color: var(--link);
}

.section-body > h1:first-child {
    margin-top: 0;
}

.section-body > h1 + h2 {
    margin-top: 16px;
}

/* Clear hierarchy inside a section page: one title, smaller section headings. */
body.section .section-body h1 { font-size: 36px; }
body.section .section-body h2 { font-size: 26px; margin-top: 40px; }
body.section .section-body h3 { font-size: 20px; margin-top: 28px; }

@media screen and (max-width: 800px) {
    body.section .section-body h1 { font-size: 30px; }
    body.section .section-body h2 { font-size: 22px; margin-top: 32px; }
}

.section-pager {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 48px;
    padding-top: 20px;
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 15px;
}

.section-nav-menu {
    display: none;
}

@media screen and (max-width: 800px) {
    .section-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }

    .section-nav {
        position: static;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--rule);
    }

    .section-nav-home,
    .section-nav-list {
        display: none;
    }

    .section-nav-menu {
        display: block;
    }

    .section-nav-menu summary {
        cursor: pointer;
        color: var(--text);
        font-weight: 700;
    }

    .section-nav-menu summary span {
        font-weight: 400;
        color: var(--muted);
    }

    .section-nav-menu ol {
        margin-top: 10px;
    }
}

/* 6. blog ---------------------------------------------------------------- */

/* Article look for /blog, /life, /robots (templates/blog/*): Lora body, Playfair headings.
   The Google Fonts link is in those templates only. */
body.blog {
    font: 400 21px/1.58 "Lora", Georgia, serif;
    letter-spacing: -0.03px;
    color: rgba(0, 0, 0, 0.84);
    background: #fff;
}

body.blog .article {
    max-width: 740px;
    margin: 40px auto;
    padding: 0 20px;
    overflow-wrap: anywhere;
}

body.blog h1,
body.blog h2,
body.blog h3 {
    color: rgba(0, 0, 0, 0.84);
    text-rendering: optimizeLegibility;
}

body.blog h1 {
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 900;
    font-size: 48px;
    line-height: 1.1;
    margin: 0 0 8px;
}

body.blog h2 {
    font-family: "Lato", "Helvetica Neue", Arial, sans-serif;
    font-weight: 700;
    font-size: 26px;
    line-height: 1.33;
    letter-spacing: -0.45px;
    margin: 56px 0 8px;
}

body.blog h3 {
    font-family: "Lato", "Helvetica Neue", Arial, sans-serif;
    font-weight: 700;
    font-size: 22px;
    margin: 40px 0 8px;
}

body.blog p,
body.blog li {
    margin: 21px 0 0;
}

body.blog li {
    margin-top: 8px;
}

body.blog a {
    color: inherit;
    text-decoration: underline;
}

body.blog a:hover {
    color: var(--link);
}

body.blog .subtitle {
    font-family: "Lato", "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    color: rgba(0, 0, 0, 0.54);
    margin: 0 0 24px;
}

body.blog blockquote {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 30px;
    font-style: italic;
    letter-spacing: -0.36px;
    line-height: 1.48;
    color: rgba(0, 0, 0, 0.68);
    border: 0;
    margin: 55px 0 33px;
    padding: 0 0 0 50px;
}

body.blog img {
    display: block;
    max-width: 100%;
    margin: 30px auto;
}

body.blog pre,
body.blog code {
    font-size: 17px;
    border: 0;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.05);
}

body.blog pre {
    padding: 1em;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    margin: 21px 0 0;
}

body.blog code {
    padding: 3px 5px;
}

body.blog pre > code {
    padding: 0;
    background: none;
}

@media screen and (max-width: 740px) {
    body.blog { font-size: 19px; }
    body.blog h1 { font-size: 36px; }
    body.blog h2 { font-size: 24px; }
    body.blog blockquote { font-size: 24px; padding-left: 20px; }
}

/* highlight.js "default" theme (was static/highlight/default.css), used on posts with code. */
pre code.hljs { display: block; overflow-x: auto; padding: 1em; }
code.hljs { padding: 3px 5px; }
.hljs { background: #f3f3f3; color: #444; }
.hljs-comment { color: #697070; }
.hljs-tag, .hljs-punctuation { color: #444a; }
.hljs-tag .hljs-name, .hljs-tag .hljs-attr { color: #444; }
.hljs-keyword, .hljs-attribute, .hljs-selector-tag, .hljs-meta .hljs-keyword, .hljs-doctag, .hljs-name { font-weight: bold; }
.hljs-type, .hljs-string, .hljs-number, .hljs-selector-id, .hljs-selector-class, .hljs-quote, .hljs-template-tag, .hljs-deletion { color: #880000; }
.hljs-title, .hljs-section { color: #880000; font-weight: bold; }
.hljs-regexp, .hljs-symbol, .hljs-variable, .hljs-template-variable, .hljs-link, .hljs-selector-attr, .hljs-operator, .hljs-selector-pseudo { color: #ab5656; }
.hljs-literal { color: #695; }
.hljs-built_in, .hljs-bullet, .hljs-code, .hljs-addition { color: #397300; }
.hljs-meta { color: #1f7199; }
.hljs-meta .hljs-string { color: #38a; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: bold; }
