/* --- Global tweaks on top of the terminal theme --- */

:root {
    --global-line-height: 1.6em;
    --prompt-color: #2a9d4b;
    --page-width: 80em;
}

/* Fixed-width side panel, the content column takes the rest */
@media only screen and (min-width: 70em) {
    .terminal-mkdocs-main-grid {
        grid-template-columns: 16em minmax(0, 1fr);
        grid-column-gap: 3em;
    }
}

/* Only show a scrollbar when a code block actually overflows */
pre code {
    overflow-x: auto;
}

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

h2 {
    margin-top: calc(var(--global-space) * 4);
    margin-bottom: calc(var(--global-space) * 0.5);
}

/* Below 70em the side panel stacks above the content: drop the page TOC there */
@media screen and (max-width: 70em) {
    #terminal-mkdocs-side-panel > hr,
    #terminal-mkdocs-side-panel > hr + nav {
        display: none;
    }
}

/* --- Prompt line under a section heading: "$ git status" --- */

p.cmd {
    margin-top: 0;
    margin-bottom: calc(var(--global-space) * 1.5);
    font-size: 0.9em;
    color: var(--secondary-color);
}

p.cmd::before {
    content: "jakob@herborn:~$ ";
    color: var(--prompt-color);
}

/* Command output directly under a prompt line (intro) */
p.cmd + p.out {
    margin-top: calc(var(--global-space) * -1.5);
}

p.out {
    margin-bottom: calc(var(--global-space) * 1.5);
    font-size: 0.9em;
}

/* --- Accents: markdown-style heading prefixes, prompt bullets, terminal links --- */

.terminal h1::before { content: "# "; color: var(--primary-color); }

h2 {
    padding-top: calc(var(--global-space) * 2.5);
    border-top: 1px dashed #c9ced3;
}
.terminal h2 { color: var(--primary-color); }
.terminal h2::before { content: "## "; color: #9aa3ab; }

/* Bullets as prompts */
#terminal-mkdocs-main-content ul > li::after {
    content: "▸";
    color: var(--primary-color);
}

/* Terminal-style links: no underline, inverted on hover */
#terminal-mkdocs-main-content a {
    text-decoration: none;
    border-bottom: 1px dotted var(--primary-color);
}
#terminal-mkdocs-main-content a:hover {
    background: var(--primary-color);
    color: var(--invert-font-color);
    border-bottom-color: transparent;
}

/* Side panel: active item with cursor, TOC with ">" markers */
.terminal-mkdocs-side-nav-item--active::before { content: "> "; color: var(--primary-color); font-style: normal; }
#terminal-mkdocs-side-panel > hr + nav a::before { content: "#"; color: #9aa3ab; margin-right: .5em; }
#terminal-mkdocs-side-panel > hr { border-top-color: #c9ced3; }

/* Table header like a command output header */
#terminal-mkdocs-main-content table th { border-bottom: 2px solid var(--primary-color); text-transform: lowercase; }

/* --- Entries (CV): role as h3, meta line underneath --- */

.terminal h3 {
    margin-top: calc(var(--global-space) * 2.5);
    margin-bottom: 0;
}

.terminal h3::before {
    content: "### ";
    color: #9aa3ab;
    font-weight: normal;
}

p.meta {
    margin-top: 2px;
    margin-bottom: calc(var(--global-space) * 1.5);
    font-size: 0.9em;
    color: var(--secondary-color);
}

/* --- Blog: post lists and photos --- */

#terminal-mkdocs-main-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Photo links open the lightbox: no link styling on them */
#terminal-mkdocs-main-content a.glightbox,
#terminal-mkdocs-main-content a.glightbox:hover {
    border-bottom: none;
    background: none;
}

.gallery > p {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18em, 1fr));
    gap: var(--global-space);
    margin-bottom: calc(var(--global-space) * 2);
}

.gallery img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

/* --- Home page photos --- */

/* Intro text with a portrait on the right; the photo spans exactly the
   height of the text block (whoami to the last line) and crops to fit */
.intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--intro-photo-width, 16.4em);
    gap: 2em;
    align-items: stretch;
}

.intro > p {
    position: relative;
    margin: 0;
}

.intro > div > :first-child {
    margin-top: 0;
}

.intro > div > :last-child {
    margin-bottom: 0;
}

/* ID selector to beat the generic content img rule (height: auto) */
#terminal-mkdocs-main-content .intro-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Two photos side by side: 2:1 left, 1:1 right, same height */
.photo-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--global-space);
    margin-bottom: var(--global-space);
}

/* Single full-width row, e.g. the panorama */
.photo-grid--full {
    grid-template-columns: 1fr;
    margin-bottom: calc(var(--global-space) * 2);
}

.photo-grid a {
    display: block;
    min-width: 0;
}

/* Width plus aspect-ratio sets the height, object-fit crops to it */
.photo-grid img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.photo-grid img.wide {
    aspect-ratio: 2 / 1;
}

.photo-grid img.pano {
    aspect-ratio: 3 / 1;
}

@media screen and (max-width: 40em) {
    .intro {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .intro > p {
        order: -1;
        width: 9em;
        height: 9em;
        margin-bottom: var(--global-space);
    }
    .photo-grid {
        grid-template-columns: 1fr;
    }
}
