/* Fonts of the printed (PDF) version, hosted in fonts/ (variable fonts: one file for weights 400-700) */
@font-face {
    font-family: 'IBM Plex Sans';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/ibm-plex-sans-latin-ext.woff2') format('woff2');
    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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'IBM Plex Sans';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/ibm-plex-sans-latin.woff2') format('woff2');
    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;
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
    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-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2');
    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;
}

/* The résumé: two panels on the dotted page (sidebar | main column) on the screen, a light A4 layout in the PDF.
   First what both share, then the screen, then print. */

/* ---------- Both ---------- */
.resume {
    display: grid;
    align-items: start;
}

/* Both columns may shrink below their content width; long words wrap instead of overflowing */
.side,
.resume_main {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Reset without specificity, so the rules below can set their own margins */
:where(.resume) :where(p, h1, h2, ul) {
    margin: 0;
}

.resume a {
    color: inherit;
    text-decoration: none;
}

.monogram {
    display: grid;
    place-items: center;
    color: #FFFFFF;
}

.contact {
    word-break: break-word;
}

.chips {
    display: flex;
    flex-wrap: wrap;
}

/* Justified: the empty ::after takes the rest of the last row, so that row stays left-aligned */
.chips::after {
    content: "";
}

/* Keeps e.g. a date range together on one line */
.nowrap,
.job-date {
    white-space: nowrap;
}

.job-top {
    display: flex;
    flex-wrap: wrap;  /* the date drops below a long title instead of squeezing it */
    justify-content: space-between;
}

/* Text with two versions: the terminal style on the screen ("## contact", "florian_braun"), plain wording with
   correct capitals in the PDF ("Contact", "Florian Braun"). The hidden one is also hidden from screen readers. */
.print_text {
    display: none;
}

/* ---------- Screen: two panels with the site's type scale, spacing and colours (see general.css) ---------- */
@media screen {
    .resume {
        grid-template-columns: minmax(272px, 352px) 1fr;  /* 352 = 22 x 16: the main column starts on a dot */
        gap: var(--space-gap);
        width: var(--column);
        max-width: 1200px;
        margin: var(--page-top) auto 0;
        padding-bottom: 96px;  /* the fixed PDF button does not cover the end of the page */
        font-size: var(--fs-text);
        line-height: var(--lh-text);
    }

    /* Same panel as the projects on the portfolio page; running text in the soft text colour, titles stay white */
    .side,
    .resume_main {
        border: 2px solid var(--color-line);
        border-radius: 12px;
        background-color: var(--color-card);
        box-shadow: var(--shadow-hard);
        color: var(--color-text-soft);
    }

    .resume a:hover {
        color: var(--color-border);
    }

    .name,
    .tagline,
    .job-title,
    .side .strong {
        color: var(--color-primary);
    }

    .contact,
    .side .sub,
    .job-date,
    .job-org,
    .muted {
        color: var(--color-secondary);
        font-size: var(--fs-small);
        line-height: var(--lh-small);
    }

    /* Sidebar */
    .side {
        padding: var(--panel-inset);
    }

    .monogram {
        width: 112px;
        height: 112px;
        margin-bottom: 48px;
        border-radius: 12px;
        background-color: var(--color-border);
        font-size: 56px;
    }

    .side-block {
        margin-bottom: 32px;
    }

    .side-block:last-child {
        margin-bottom: 0;
    }

    /* "## contact" etc.: section titles of the sidebar, sized like the card titles of the type scale */
    .side-head {
        margin-bottom: var(--space-title);
        color: var(--color-border);
        font-size: var(--fs-h3);
        line-height: var(--lh-h3);
    }

    /* Stack: same outlined chips as the tags on the portfolio. Every chip is n small grid squares wide (8px each),
       set per chip as style="--n: 9" (choose the smallest n its text fits in). Justified: the gaps in a row stretch
       (at least 8px) so every row ends at the sidebar's right edge. */
    .chips {
        justify-content: space-between;
        gap: 8px;
    }

    .chips::after {
        flex: auto;
    }

    .chip {
        box-sizing: border-box;
        width: calc(var(--n) * 8px);  /* without --n: unset, the natural width */
        padding: 2px 12px;
        border: 2px solid var(--color-line);
        border-radius: 6px;
        font-size: var(--fs-chip);
        line-height: var(--lh-chip);
        text-align: center;
        white-space: nowrap;
    }

    /* Space between entries, e.g. two degrees under education */
    .side .sub + .strong {
        margin-top: 16px;
    }

    /* Main column */
    .resume_main {
        padding-bottom: var(--panel-inset);
    }

    .resume_header {
        padding: var(--panel-inset) var(--panel-inset) 0;
    }

    .prompt {
        color: var(--color-border);
    }

    .name {
        font-size: 64px;
        font-weight: normal;
        line-height: 80px;
    }

    /* Markdown, like the "##" section headings: the name is the top heading ("# "), the points are "- " items */
    .name::before {
        content: "# ";
        color: var(--color-border);
    }

    .tagline {
        margin-bottom: 16px;
        font-size: var(--fs-h3);
        line-height: var(--lh-h3);
    }

    .summary {
        max-width: 800px;
        color: var(--color-secondary);
    }

    .resume_section {
        padding: 32px var(--panel-inset) 0;
    }

    /* "## experience" etc.: the sections of the page (h2 of the type scale), in blue like the sidebar's */
    .main-head {
        margin-bottom: var(--space-title);
        color: var(--color-border);
        font-size: var(--fs-h2);
        font-weight: normal;
        line-height: var(--lh-h2);
    }

    /* Vertical spacing on the 8px grid; the 2px and 1px rules plus their margin make 16px */
    .rule-accent {
        height: 2px;
        margin-bottom: 14px;
        background-color: var(--color-border);
    }

    .rule-soft {
        height: 1px;
        margin-bottom: 15px;
        background-color: var(--color-secondary);
    }

    .job {
        margin-bottom: 32px;
    }

    .resume_section:last-child .job:last-child {
        margin-bottom: 0;
    }

    /* Title (28px) and date (20px) in 32px rows, centred: aligned at their baselines they would push the row
       2px off the grid */
    .job-top {
        align-items: center;
        gap: 0 16px;
    }

    .job-title {
        font-size: var(--fs-h3);
        line-height: var(--lh-h3);
    }

    .job ul {
        margin-top: 16px;
        padding-left: 24px;
        list-style-type: "- ";
    }

    .job li::marker {
        color: var(--color-primary);  /* white in dark mode, dark in light mode, like the job titles */
    }

    /* Small text inside a line of running text (e.g. "[link]" after a project): its own taller line box would
       make the line 33px instead of 32px */
    p .muted {
        line-height: 1;
    }

    .project-name {
        color: var(--color-border);
    }

    /* Save as PDF: same button as "Try it" and "Send" (48px tall), in the bottom right corner of the window. Its
       right edge sits on a grid line: of the lines right of the content column (every 16px from its edge), the one
       furthest right that still keeps 24px from the window edge. (In a fixed element 100% is the window width.) */
    .print_button {
        position: fixed;
        right: calc((100% - var(--column)) / 2 - round(down, (100% - var(--column)) / 2 - 24px, 16px));
        bottom: 24px;
        display: inline-flex;
        align-items: center;
        min-height: 48px;
        padding: 8px 24px;
        border: none;
        border-radius: 8px;
        background-color: var(--color-border);
        color: #FFFFFF;
        font-family: var(--font-primary);
        font-size: var(--fs-button);
        line-height: 32px;
        text-decoration: none;
        cursor: pointer;
        box-shadow: 3px 3px 0 var(--color-shadow);
        transition: translate 0.12s steps(2), box-shadow 0.12s steps(2);
    }

    .print_button:active {
        translate: 2px 2px;
        box-shadow: 1px 1px 0 var(--color-shadow);
    }
}

@media screen and (hover: hover) {
    .print_button:hover {
        filter: brightness(1.1);
    }
}

/* Wide windows: enough room right of the content column, so the button sits in the middle between the column's
   right edge and the window edge, its left edge on the nearest 16px grid line. --snap-width is the button's width
   from the generated "build: snap" rules at the end of this file (160px without it). */
@media screen and (min-width: 1600px) {
    .print_button {
        right: auto;
        left: calc(50% + var(--column) / 2
                   + round(nearest, ((100% - var(--column)) / 2 - var(--snap-width, 160px)) / 2, 16px));
    }
}

/* Narrow screens and portrait tablets: one column, name and experience first, the sidebar follows */
@media screen and (max-width: 900px) {
    .resume {
        grid-template-columns: 1fr;
    }

    .side {
        order: 2;
    }

    .monogram {
        width: 80px;
        height: 80px;
        margin-bottom: 32px;
        font-size: 40px;
    }
}

@media screen and (max-width: 760px) {
    .print_button {
        right: calc((100% - var(--column)) / 2);
        bottom: calc(var(--bottom-bar) + 16px);  /* above the tab bar */
    }
}

@media screen and (max-width: 600px) {
    .name {
        font-size: 40px;
        line-height: 48px;
    }
}

/* ---------- Print / PDF: light A4 layout ---------- */
@page {
    size: A4;
    margin: 0;
}

@media print {
    nav,
    .print_button,
    .screen_text {
        display: none;
    }

    .print_text {
        display: inline;
    }

    /* Page colour behind the main column */
    html {
        background-color: #FAFAF7;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body {
        background: none;
    }

    main {
        width: auto;
        margin: 0;
        padding: 0;
        background: none;
    }

    .resume {
        --accent: #0D99FF;
        --ink: #1C1917;
        --muted: #57534E;
        --soft: #44403C;
        --paper: #FAFAF7;
        --sidebar: #F0EFEA;
        --rule: #D6D3D1;
        --sideborder: #E7E5E4;
        --mono: "JetBrains Mono", "Fira Mono", monospace;

        /* No fixed A4 size: browsers that keep their own page margins
           (Safari) would otherwise spill onto a second page */
        grid-template-columns: 66mm 1fr;
        min-height: 0;
        color: var(--ink);
        font-family: "IBM Plex Sans", system-ui, sans-serif;
        font-size: 9pt;
        line-height: 1.4;
    }

    .resume * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Sidebar. Its grey background is a fixed strip, because in print fixed elements fill the full height of
       every page */
    .side {
        padding: 14mm 6mm 14mm 8mm;
    }

    .resume::before {
        content: "";
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: -1;
        width: 66mm;
        background-color: var(--sidebar);
        border-right: 0.6pt solid var(--sideborder);
    }

    .monogram {
        width: 20mm;
        height: 20mm;
        margin-bottom: 18pt;
        border-radius: 3pt;
        background-color: var(--accent);
        font-family: var(--mono);
        font-weight: 700;
        font-size: 20pt;
    }

    .side-block {
        margin-bottom: 16pt;
    }

    .side-head {
        margin-bottom: 4pt;
        color: var(--accent);
        font-family: var(--mono);
        font-weight: 700;
        font-size: 10pt;  /* same as the main column's section headings: all sections are one level */
    }

    .contact {
        color: var(--soft);
        font-family: var(--mono);
        font-size: 8pt;
        line-height: 1.55;
    }

    /* Justified like on the screen: equal gaps, the chips of a row grow so it ends at the right edge; the last
       row keeps its natural widths */
    .chips {
        gap: 4pt 3pt;
    }

    .chips::after {
        flex-grow: 1000;
    }

    .chip {
        flex-grow: 1;
        text-align: center;
        padding: 1.2pt 3.5pt;
        border: 0.5pt solid var(--rule);
        border-radius: 1.5pt;
        background-color: var(--paper);
        font-family: var(--mono);
        font-size: 7pt;
    }

    .side .strong {
        font-weight: 600;
    }

    .side .sub {
        color: var(--soft);
    }

    .side .sub + .strong {
        margin-top: 6pt;
    }

    /* Main column */
    .resume_header {
        padding: 15mm 10.5mm 0;
    }

    .prompt {
        margin-bottom: 2pt;
        color: var(--accent);
        font-family: var(--mono);
        font-size: 8pt;
    }

    .name {
        margin-bottom: 3pt;
        font-family: var(--mono);
        font-weight: 700;
        font-size: 26pt;
        line-height: 1.15;
    }

    .tagline {
        margin-bottom: 14pt;
        font-size: 12pt;
    }

    .summary {
        margin-bottom: 16pt;
        color: var(--soft);
    }

    .resume_section {
        padding: 0 10.5mm;
        margin-bottom: 16pt;
    }

    .main-head {
        margin-bottom: 6pt;
        color: var(--accent);
        font-family: var(--mono);
        font-weight: 700;
        font-size: 10pt;
    }

    .rule-accent {
        height: 1.4pt;
        margin-bottom: 5pt;
        background-color: var(--accent);
    }

    .rule-soft {
        height: 0.5pt;
        margin-bottom: 5pt;
        background-color: var(--rule);
    }

    .job {
        margin-bottom: 9pt;
        break-inside: avoid;
    }

    .job-top {
        align-items: baseline;
        gap: 8pt;
    }

    .job-title {
        font-size: 11.5pt;
        font-weight: 700;
    }

    .job-date {
        font-family: var(--mono);
        font-size: 8pt;
    }

    .job-date,
    .job-org,
    .muted {
        color: var(--muted);
    }

    .job ul {
        margin-top: 3pt;
        padding-left: 12pt;
    }

    .job li {
        margin-bottom: 1.5pt;
    }

    .project-name {
        color: var(--ink);
        font-family: var(--mono);
        font-weight: 700;
    }
}

/* build: snap - generated by build_snap.py from resume.html: the sizes snapped to the 16px grid (see general.css, "Snapped to the grid"). Do not edit between these lines: run the script again after changing the page. */
@media screen {
    main > a:nth-child(2) { --snap-width: 160px; }
}
@media screen and (width < 601px) {
    @container page (352px <= width < 416px) {
        main > div:nth-child(1) > aside:nth-child(1) > div:nth-child(3) > div:nth-child(2) { --snap-pad: 8px; }
    }
    @container page (544px <= width) {
        main > div:nth-child(1) > aside:nth-child(1) > div:nth-child(3) > div:nth-child(2) { --snap-pad: 8px; }
    }
}
@media screen and (1000px <= width) {
    main > div:nth-child(1) > aside:nth-child(1) > div:nth-child(3) > div:nth-child(2) { --snap-pad: 8px; }
}
@media screen and (601px <= width < 761px) {
    @container page (592px <= width) {
        main > div:nth-child(1) > aside:nth-child(1) > div:nth-child(3) > div:nth-child(2) { --snap-pad: 8px; }
    }
}
@media screen and (761px <= width < 901px) {
    main > div:nth-child(1) > aside:nth-child(1) > div:nth-child(3) > div:nth-child(2) { --snap-pad: 8px; }
}
@media screen and (901px <= width < 1000px) {
    main > div:nth-child(1) > aside:nth-child(1) > div:nth-child(3) > div:nth-child(2) { --snap-pad: 8px; }
}
/* /build: snap */
