/*
 * One stylesheet for the whole site. No framework, no build step, no client-side JavaScript.
 *
 * Dark is the default and light follows the reader's system setting, so the palette lives in
 * custom properties and nothing below this block names a colour directly. The print rules at the
 * bottom force light on white and are what makes /cv/ printable, which is why there is no PDF.
 */

/* --- Fonts ---------------------------------------------------------------- */
/*
 * Space Grotesk, SIL OFL 1.1, vendored under static/fonts. See the README there. Both files are
 * the variable font over the 300-700 weight axis, split by the unicode ranges Google subsets on,
 * so a page with no accented characters never fetches the extended one. Headings only. Running
 * text stays on the system sans, which costs nothing and reads better at small sizes.
 */

@font-face {
    font-family: "Space Grotesk";
    src: url("/static/fonts/space-grotesk-latin.woff2") format("woff2");
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
        U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
        U+FEFF, U+FFFD;
}

/* Czech diacritics live here: U+0100-02BA covers c/d/e/n/r/s/t/u/z with their marks. */
@font-face {
    font-family: "Space Grotesk";
    src: url("/static/fonts/space-grotesk-latin-ext.woff2") format("woff2");
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
        U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
        U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Palette -------------------------------------------------------------- */

:root {
    --bg: #0c0d10;
    --bg-lift: #14161b;
    --ink: #e9ebee;
    --ink-soft: #99a0ab;
    --line: #23262d;
    --line-strong: #333842;
    --accent: #5f9dff;

    --display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
    --text: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

    --measure: 40rem;
    --gap: 1.6rem;
    --header-h: 5.2rem;

    color-scheme: dark;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #fdfdfc;
        --bg-lift: #f3f4f6;
        --ink: #16191d;
        --ink-soft: #5b626b;
        --line: #e3e6ea;
        --line-strong: #cfd4da;
        --accent: #1f5fa8;

        color-scheme: light;
    }
}

/* --- Base ----------------------------------------------------------------- */

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

html {
    font-size: 17px;
}

body {
    margin: 0;
    padding: 0 var(--gap);
    background: var(--bg);
    color: var(--ink);
    font-family: var(--text);
    line-height: 1.65;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

/* --- Layout --------------------------------------------------------------- */

.site-header,
.content,
.site-footer,
.hero-inner {
    max-width: var(--measure);
    margin-inline: auto;
}

.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.6rem 1.4rem;
    min-height: var(--header-h);
    padding: 2.2rem 0 1.2rem;
    border-bottom: 1px solid var(--line);
}

/*
 * On the home page the hero owns the first screen, so the rule under the navigation would cut it
 * in half. The hero draws its own at the bottom instead, where the document actually starts.
 */
.layout-home .site-header {
    border-bottom: 0;
}

.brand {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.02rem;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-decoration: none;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.1rem;
}

.lang-switch {
    margin-left: auto;
    font-size: 0.88rem;
}

.site-nav a,
.lang-switch a {
    color: var(--ink-soft);
    text-decoration: none;
    transition: color 0.15s ease;
}

.site-nav a:hover,
.lang-switch a:hover {
    color: var(--ink);
}

.site-nav a[aria-current="page"] {
    color: var(--ink);
}

.content {
    padding: 3rem 0 4.5rem;
}

.site-footer {
    padding: 1.4rem 0 2.5rem;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 0.85rem;
}

.site-footer p {
    margin: 0;
}

/* --- Hero ----------------------------------------------------------------- */
/*
 * The first screen of the home page: the name, one paragraph saying what the person does, and a
 * row of places to go next. Everything above the first "## " heading in the content file lands
 * here, so the page decides where the intro ends rather than the template. See internal/content.
 */

.hero {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-h));
    min-height: calc(100svh - var(--header-h));
    border-bottom: 1px solid var(--line);
    text-align: center;
}

.hero-inner {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 0;
}

.hero h1 {
    margin: 0 0 1.2rem;
    font-size: clamp(2.7rem, 11vw, 5.25rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
}

.hero p {
    margin: 0 auto 1rem;
    max-width: 32rem;
    font-size: clamp(1.02rem, 2.4vw, 1.2rem);
    color: var(--ink-soft);
}

/* The first paragraph is the one-line summary, so it carries the full text colour. */
.hero h1 + p {
    color: var(--ink);
}

.hero p a {
    color: inherit;
    text-decoration-color: var(--line-strong);
}

.hero p a:hover {
    color: var(--accent);
    text-decoration-color: currentColor;
}

/* A plain Markdown list in the intro becomes the row of links. */
.hero ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin: 1.6rem 0 0;
    padding: 0;
    list-style: none;
}

.hero li {
    margin: 0;
}

.hero li a {
    display: block;
    padding: 0.45rem 1.1rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--ink-soft);
    font-size: 0.92rem;
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.hero li a:hover {
    border-color: var(--accent);
    background: var(--bg-lift);
    color: var(--ink);
}

.hero-cue {
    padding-bottom: 2.4rem;
    color: var(--ink-soft);
    font-size: 1.1rem;
    line-height: 1;
    opacity: 0.55;
}

/* --- Typography ----------------------------------------------------------- */

h1, h2, h3 {
    font-family: var(--display);
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.025em;
    margin: 2.8rem 0 0.7rem;
}

h1 {
    font-size: 2.35rem;
    margin-top: 0;
}

h2 {
    font-size: 1.35rem;
    padding-top: 1.6rem;
    border-top: 1px solid var(--line);
}

/*
 * The home page opens straight into a section, and the hero already draws a rule where the
 * document begins. A second one right under it reads as a mistake.
 */
.content > h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

h3 {
    font-size: 1.02rem;
    letter-spacing: -0.015em;
    margin-bottom: 0.2rem;
}

p, ul, ol {
    margin: 0 0 1.05rem;
}

ul, ol {
    padding-left: 1.15rem;
}

li {
    margin-bottom: 0.35rem;
}

li::marker {
    color: var(--ink-soft);
}

/* The lead paragraph, meaning the one straight after the page title. */
.content h1 + p {
    font-size: 1.12rem;
    color: var(--ink-soft);
}

a {
    color: var(--accent);
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

strong {
    font-weight: 600;
    color: var(--ink);
}

code {
    font-family: var(--mono);
    font-size: 0.86em;
    background: var(--bg-lift);
    border: 1px solid var(--line);
    padding: 0.08em 0.35em;
    border-radius: 3px;
}

blockquote {
    margin: 1.2rem 0;
    padding-left: 1rem;
    border-left: 2px solid var(--line-strong);
    color: var(--ink-soft);
}

hr {
    margin: 2.8rem 0;
    border: 0;
    border-top: 1px solid var(--line);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.2rem;
    font-size: 0.94rem;
}

th, td {
    text-align: left;
    padding: 0.5rem 0.6rem 0.5rem 0;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    font-family: var(--display);
    font-weight: 600;
    color: var(--ink-soft);
}

/* --- Skills --------------------------------------------------------------- */
/*
 * Substituted for the [[skills]] token on the CV page. The icons are inlined SVG taking the
 * colour of the text, so there is nothing to load and they survive printing. Not every tool has
 * an icon and entries without one are just the label, because a row of placeholders reads as
 * something having gone wrong.
 */

.skills {
    margin: 1.4rem 0 1.8rem;
}

.skill-group + .skill-group {
    margin-top: 1.3rem;
}

.skill-group-label {
    font-family: var(--display);
    margin: 0 0 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1.3rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.skill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.94rem;
}

.skill .icon {
    width: 1.05em;
    height: 1.05em;
    flex: none;
    color: var(--ink-soft);
}

/* --- Small screens -------------------------------------------------------- */

@media (max-width: 34rem) {
    html {
        font-size: 16px;
    }

    :root {
        --header-h: 4.4rem;
    }

    .site-header {
        padding-top: 1.6rem;
    }

    .lang-switch {
        margin-left: 0;
    }

    .content {
        padding-top: 2.4rem;
    }

    h1 {
        font-size: 1.85rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
    }
}

/* --- Print ---------------------------------------------------------------- */
/*
 * What Ctrl+P on /cv/ produces. Navigation, the language switch and link colours are noise on
 * paper, and link targets are printed after the text so a printed CV still carries its URLs.
 * The screen palette is overridden outright, because a dark page is not something to put on A4.
 */

@page {
    size: A4;
    margin: 18mm 16mm;
}

@media print {
    html {
        font-size: 10.5pt;
    }

    body {
        padding: 0;
        background: #fff;
        color: #000;
    }

    .site-header,
    .site-footer,
    .hero-cue {
        display: none;
    }

    .content {
        max-width: none;
        padding: 0;
    }

    /* On paper there is no fold to fill, so the intro is just the top of the document. */
    .hero {
        display: block;
        min-height: 0;
        border-bottom: 0;
        text-align: left;
    }

    .hero-inner {
        display: block;
        max-width: none;
        padding: 0;
    }

    .hero h1 {
        font-size: 1.6em;
    }

    .hero p,
    .hero li a {
        color: #000;
    }

    .hero ul {
        display: block;
        justify-content: normal;
    }

    .hero li a {
        display: inline;
        padding: 0;
        border: 0;
    }

    a {
        color: #000;
        text-decoration: none;
    }

    .content a[href^="http"]::after,
    .hero a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.85em;
        color: #444;
        word-break: break-all;
    }

    h1 {
        font-size: 1.6em;
    }

    h2 {
        font-size: 1.15em;
        page-break-after: avoid;
        break-after: avoid;
    }

    h3 {
        page-break-after: avoid;
        break-after: avoid;
    }

    li, tr, blockquote {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    code {
        background: transparent;
        border: 0;
    }

    .skill .icon {
        color: #000;
    }

    .skill-group,
    .skills {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}
