/* jorgesintes.dev: the whole site stylesheet (code colours live in catppuccin-*.css).
   Order: tokens, reset/base, typography, layout, components, pages, utilities.
   Every margin, padding and gap uses a --space-* token; exceptions are commented. */

/* ---------- Fonts: self-hosted variable woff2 (latin subset), licences in /fonts/ ---------- */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/inter-latin-wght-italic.woff2") format("woff2");
}

@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url("/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
}

/* ---------- Tokens ---------- */
:root {
    /* Spacing: 4 8 12 16 24 32 48 64 96 px */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4rem;
    --space-9: 6rem;

    /* Type: 16px body on phones, 17px from 768px; headings on a ~1.25 scale from 17px */
    --font-sans: "Inter", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
        "Segoe UI Emoji", "Noto Color Emoji";
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --text-xs: 0.8125rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-md: 1.125rem;
    --text-lg: 1.3125rem;
    --text-xl: 1.625rem;
    --text-2xl: 2.0625rem;
    --text-3xl: 2.5rem;
    --leading: 1.65;
    --leading-tight: 1.25;

    /* Layout: a ~68-character reading column plus the 15rem contents sidebar */
    --measure: 38rem;
    --sidebar: 15rem;
    --container: calc(var(--measure) + var(--space-7) + var(--sidebar));
    --gutter: var(--space-4);
    --radius: 0.25rem;
    --radius-lg: 0.75rem;

    /* Colours, light theme (the values the site rendered before this stylesheet) */
    --color-bg: #fff;
    --color-surface: #fff;
    --color-surface-2: #fbfbfc;
    --color-text: #373c44;
    --color-heading: #2d3138;
    --color-subheading: #424751;
    --color-muted: #646b79;
    --color-border: #e7eaf0;
    --color-border-strong: #525f7a;
    --color-contrast: #181c25;
    --color-secondary: #5d6b89;
    --color-secondary-hover: #48536b;
    --color-accent: #577400;
    --color-accent-strong: #435a00;
    --color-accent-underline: rgba(87, 116, 0, 0.5);
    --color-button: #a5d601;
    --color-button-hover: #99c801;
    --color-button-text: #000;
    --color-code-bg: #f3f5f7;
    --color-code: #646b79;
    --color-kbd-bg: #373c44;
    --color-kbd: #fff;
    --color-mark-bg: #fde6bf;
    --color-selection: rgba(119, 156, 0, 0.25);
    --color-position-title: var(--color-subheading);
    --color-logo-tile: #fff;
}

[data-theme="dark"] {
    --color-bg: #13171f;
    --color-surface: #181c25;
    --color-surface-2: #1a1e28;
    --color-text: #c2c7d0;
    --color-heading: #f0f1f3;
    --color-subheading: #c2c7d0;
    --color-muted: #7b8495;
    --color-border: #202632;
    --color-contrast: #dfe3eb;
    --color-secondary: #969eaf;
    --color-secondary-hover: #b3b9c5;
    --color-accent: #82ab00;
    --color-accent-strong: #99c801;
    --color-accent-underline: rgba(130, 171, 0, 0.5);
    --color-button-hover: #b2e51a;
    --color-code-bg: #1a1e28;
    --color-code: #8891a4;
    --color-kbd-bg: #c2c7d0;
    --color-kbd: #13171f;
    --color-mark-bg: #014063;
    --color-selection: rgba(130, 171, 0, 0.19);
    --color-position-title: hsl(51.43, 81.12%, 54.31%);
    --color-logo-tile: #1a1e28;
    color-scheme: dark;
}

@media (min-width: 768px) {
    :root { --text-base: 1.0625rem; --gutter: var(--space-5); }
}

/* Below the sidebar breakpoint the whole page narrows to the reading column. */
@media (max-width: 1023px) {
    :root { --container: var(--measure); }
}

/* ---------- Reset and base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body,
h1, h2, h3, h4, h5, h6,
p, ul, ol, dl, dd, figure, blockquote, pre, hr, table { margin: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--color-bg); scroll-behavior: smooth; }

body {
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading);
    text-rendering: optimizeLegibility;
}

img, video, svg { max-width: 100%; height: auto; }
img, video { display: block; }
::selection { background: var(--color-selection); }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 2px; }

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

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
    color: var(--color-heading);
    font-weight: 700;
    line-height: var(--leading-tight);
    text-wrap: balance;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); color: var(--color-subheading); }
h4, h5, h6 { font-size: var(--text-base); color: var(--color-subheading); }
p, li { text-wrap: pretty; }

a {
    color: var(--color-accent);
    text-decoration: underline;
    text-decoration-color: var(--color-accent-underline);
    text-underline-offset: 0.15em;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover { color: var(--color-accent-strong); text-decoration-color: currentColor; }
strong, b { font-weight: 700; }
small { font-size: var(--text-sm); }
ul { list-style: square; }
ul, ol { padding-left: var(--space-5); }
hr { border: 0; border-top: 1px solid var(--color-border); }

blockquote {
    padding: var(--space-2) var(--space-4);
    border-left: 4px solid var(--color-border);
    color: var(--color-muted);
}

code, kbd, pre { font-family: var(--font-mono); font-size: 0.875em; }

:not(pre) > code {
    padding: calc(var(--space-1) / 2) calc(var(--space-1) * 1.5);
    border-radius: var(--radius);
    background: var(--color-code-bg);
    color: var(--color-code);
    /* Long identifiers would otherwise push narrow pages sideways. */
    overflow-wrap: anywhere;
}

kbd {
    padding: calc(var(--space-1) / 2) var(--space-1);
    border-radius: var(--radius);
    background: var(--color-kbd-bg);
    color: var(--color-kbd);
}

pre {
    padding: var(--space-4) var(--space-5);
    overflow-x: auto;
    border-radius: var(--radius);
    background: var(--color-code-bg);
    line-height: 1.6;
}

pre code { font-size: inherit; }
mark { background: var(--color-mark-bg); color: inherit; }
sup { line-height: 0; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }

th, td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
    text-align: left;
}

figcaption { color: var(--color-muted); font-size: var(--text-xs); }
details summary { display: flex; align-items: center; cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }

/* A chevron pointing right that turns down when open. */
details summary::after {
    content: "";
    width: 0.45em;
    height: 0.45em;
    margin-left: auto;
    margin-right: var(--space-1);
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
}

details[open] summary::after { transform: rotate(45deg); }

/* Prose: one flow rule for every block in posts, the CV and the home intro.
   Headings get more room above than below so they attach to what follows. */
.prose > * + * { margin-top: var(--space-4); }
.prose > h2 { margin-top: var(--space-7); }
.prose > h3 { margin-top: var(--space-6); }
.prose > :is(h4, h5, h6) { margin-top: var(--space-5); }
.prose > :is(h2, h3, h4, h5, h6) + * { margin-top: var(--space-3); }
.prose > :is(h2, h3) + :is(h3, h4) { margin-top: var(--space-4); }
.prose > :first-child { margin-top: 0; }
.prose > hr { margin-block: var(--space-7); }
.prose > hr + * { margin-top: 0; }
.prose > :is(ul, ol) li + li, .prose > :is(ul, ol) li > :is(ul, ol) { margin-top: var(--space-2); }
.prose li > p + p { margin-top: var(--space-2); }
.prose img { border-radius: var(--radius); }
.prose > p:has(> img:only-child) { margin-block: var(--space-5); }
.prose > :is(.highlight, pre, blockquote, video, table) { margin-block: var(--space-5); }
.footnotes { color: var(--color-muted); font-size: var(--text-sm); }
.footnotes hr { margin-bottom: var(--space-4); }
.footnotes li + li, .footnotes li > * + * { margin-top: var(--space-2); }

/* ---------- Layout ---------- */
.page-container {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    width: 100%;
    max-width: calc(var(--container) + 2 * var(--gutter));
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.content-wrap { flex-grow: 1; }
.site-header { border-bottom: 1px solid var(--color-border); }

.page-header {
    padding-block: var(--space-6) var(--space-5);
    margin-bottom: var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.site-footer {
    margin-top: var(--space-8);
    padding-block: var(--space-5) var(--space-6);
    border-top: 1px solid var(--color-border);
}

/* Posts and the CV: a reading column, plus the contents sidebar from 1024px. */
.article-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
.text-container { min-width: 0; max-width: var(--measure); }

@media (min-width: 1024px) {
    .article-grid { grid-template-columns: minmax(0, var(--measure)) var(--sidebar); gap: var(--space-7); }
}

@media (max-width: 1023px) {
    .toc-container { order: -1; }
}

/* ---------- Components ---------- */

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: 1px solid var(--color-button);
    border-radius: var(--radius);
    background: var(--color-button);
    color: var(--color-button-text);
    font: inherit;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.button:hover {
    border-color: var(--color-button-hover);
    background: var(--color-button-hover);
    color: var(--color-button-text);
}

.button:active { transform: translateY(1px); }

.button-outline {
    border-color: var(--color-secondary);
    background: transparent;
    color: var(--color-secondary);
}

.button-outline:hover {
    border-color: var(--color-secondary-hover);
    background: transparent;
    color: var(--color-secondary-hover);
}

/* Muted links (contact links, footer, back to top) */
.link-muted {
    color: var(--color-secondary);
    text-decoration-color: color-mix(in srgb, var(--color-secondary) 50%, transparent);
}

.link-muted:hover { color: var(--color-secondary-hover); }
.icon { width: 1em; height: 1em; flex: none; fill: currentColor; }

/* Nav */
.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding-block: var(--space-4);
}

.site-nav ul {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0;
    list-style: none;
}

/* Flex items so the 48px logo and the text links share one centre line. */
.site-nav li { display: flex; }
.site-nav a { display: block; padding: var(--space-2) var(--space-3); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--color-contrast); font-weight: 600; }

.site-nav .brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0;
    color: var(--color-contrast);
    font-weight: 700;
    white-space: nowrap;
}

.brand img { width: 3rem; height: 3rem; }

/* The turtle wiggles when the pointer arrives and shakes a little more when clicked; turtle.js sets the classes. */
@keyframes turtle-wiggle {
    0%, 100% { transform: rotate(0); }
    30% { transform: rotate(-3deg); }
    70% { transform: rotate(3deg); }
}

@keyframes turtle-shake {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(-6deg); }
    45% { transform: rotate(6deg); }
    70% { transform: rotate(-3deg); }
    85% { transform: rotate(2deg); }
}

.brand.is-wiggling img { animation: turtle-wiggle 0.35s ease-in-out; }
.brand.is-shaking img { animation: turtle-shake 0.4s ease-in-out; }

@media (prefers-reduced-motion: reduce) {
    .brand img { animation: none !important; }
}

.theme-toggle {
    display: flex;
    padding: var(--space-2);
    border: 0;
    background: none;
    color: var(--color-secondary);
    font-size: var(--text-lg);
    cursor: pointer;
}

.theme-toggle:hover { color: var(--color-secondary-hover); }

[data-theme="dark"] .theme-toggle .icon:last-child,
:root:not([data-theme="dark"]) .theme-toggle .icon:first-child { display: none; }

@media (max-width: 575px) {
    .brand img { width: 2.5rem; height: 2.5rem; }
    .site-nav .brand { gap: var(--space-2); }
}

@media (max-width: 400px) {
    .site-nav ul { gap: 0; }
    .site-nav a { padding-inline: var(--space-2); }
}

/* Page header and post meta */
.post-meta { margin-top: var(--space-2); color: var(--color-muted); font-size: var(--text-sm); }

/* Cards: a hairline border, no shadow */
.card {
    --card-padding: var(--space-5);
    padding: var(--card-padding);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}

@media (max-width: 575px) {
    .card { --card-padding: var(--space-4); }
}

/* Contents list: details on small screens, sticky sidebar from 1024px */
.toc details { padding-bottom: var(--space-3); border-bottom: 1px solid var(--color-border); }
.toc summary { padding-block: var(--space-2); color: var(--color-muted); }
.toc ul { padding: 0; list-style: none; }
.toc li { padding-block: var(--space-1); font-size: var(--text-sm); }
.toc li ul { padding-left: var(--space-4); padding-top: var(--space-1); }
.toc li li { font-size: var(--text-xs); }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.back-to-top { display: none; font-size: var(--text-sm); }

@media (min-width: 1024px) {
    .toc {
        position: sticky;
        top: var(--space-6);
        max-height: calc(100dvh - 2 * var(--space-6));
        overflow-y: auto;
        padding-left: var(--space-4);
        border-left: 1px solid var(--color-border);
    }

    .toc details { padding: 0; border: 0; }
    .toc summary { display: none; }
    .back-to-top { display: inline-block; margin-top: var(--space-4); }
}

/* Older/newer links at the end of a post */
.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border);
}

.prose > .post-nav { margin-top: var(--space-7); }
.post-nav a { display: flex; flex-direction: column; text-decoration: none; }
.post-nav small { color: var(--color-muted); }
.post-nav-newer { grid-column: 2; text-align: right; }
.prose > .post-nav + p { margin-top: var(--space-5); }

@media (max-width: 575px) {
    .post-nav { grid-template-columns: 1fr; }
    .post-nav-newer { grid-column: 1; text-align: left; }
}

/* Code blocks and the copy buttons */
.code-wrapper { position: relative; }

/* Room above the first line so the copy button never covers code. */
.code-wrapper pre { padding-top: var(--space-6); }

.copy-button {
    position: absolute;
    top: var(--space-1);
    right: var(--space-1);
    display: flex;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--color-muted);
    font: inherit;
    font-size: var(--text-xs);
    line-height: 1;
    opacity: 0.6;
    cursor: pointer;
}

.copy-button:hover, .copy-button:focus-visible {
    border-color: var(--color-accent);
    color: var(--color-accent);
    opacity: 1;
}

.copy-button svg { width: 0.8rem; height: 0.8rem; fill: currentColor; }

.copy-url-pill.copy-button {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    max-width: 100%;
    padding: var(--space-1) var(--space-2);
    background: var(--color-surface);
    color: var(--color-accent);
    font-family: var(--font-mono);
    line-height: 1.2;
    vertical-align: middle;
    opacity: 1;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.copy-url-pill-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-url-pill-icon { display: inline-flex; }
.copy-url-pill[data-copied="true"] .copy-url-pill-icon { color: var(--color-accent-strong); }

/* Footer */
.footer-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--space-4);
}

.footer-left { display: flex; flex-direction: column; }
.footer-links { display: flex; font-size: var(--text-lg); }

/* 8px padding around 20px icons gives ~40px tap targets. */
.footer-links a { display: flex; padding: var(--space-3); }
.footer-right { justify-self: end; }

/* Phones and tablets: just the signature line and the contact icons. */
@media (max-width: 1023px) {
    .site-footer { padding-bottom: var(--space-5); }
    .footer-content { grid-template-columns: 1fr; justify-items: center; gap: var(--space-2); text-align: center; }
    .footer-left .muted,
    .footer-right { display: none; }
}

/* ---------- Pages ---------- */

/* Home */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-5);
    padding-top: var(--space-6);
    text-align: center;
}

.hero-photo { width: clamp(11rem, 22vw, 15rem); }
.hero-photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; }
.hero-photo figcaption { margin-top: var(--space-2); text-align: center; }
.main-title { font-size: var(--text-2xl); font-weight: 800; }

.subtitle {
    margin-top: var(--space-1);
    color: var(--color-muted);
    font-size: var(--text-md);
    font-weight: 500;
}

.home-content { margin-top: var(--space-5); font-size: var(--text-md); text-align: left; }

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

@media (min-width: 768px) {
    .main-title { font-size: var(--text-3xl); }
    .subtitle { font-size: var(--text-lg); }
}

@media (min-width: 1024px) {
    .hero {
        display: grid;
        grid-template-columns: 16rem minmax(0, 1fr);
        align-items: center;
        gap: var(--space-7);
        text-align: left;
    }

    .hero-photo { width: 100%; }
    .hero-actions { justify-content: flex-start; }
}

.home-section { margin-top: var(--space-8); }
.home-section > * + * { margin-top: var(--space-4); }
.home-section > h2 + * { margin-top: var(--space-3); }
.project-grid { display: grid; gap: var(--space-4); }

@media (min-width: 1024px) {
    .project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.project-card { display: flex; flex-direction: column; gap: var(--space-2); overflow: hidden; }
.project-card h3 { font-size: var(--text-md); }
.project-card p { flex-grow: 1; font-size: var(--text-sm); }

/* The link row bleeds to the card edges as a footer strip. */
.project-card footer {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--card-padding);
    margin: var(--space-3) calc(-1 * var(--card-padding)) calc(-1 * var(--card-padding));
    padding: var(--space-3) var(--card-padding);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-2);
    font-size: var(--text-sm);
}

.latest-posts { padding: 0; list-style: none; }

.latest-posts li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0 var(--space-4);
    padding-block: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.latest-posts time {
    color: var(--color-muted);
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
}

/* Post list */
.article-links { display: flex; flex-direction: column; gap: var(--space-4); }

.article-link {
    display: grid;
    grid-template-columns: 14rem minmax(0, 1fr);
    grid-template-areas:
        "thumb head"
        "thumb summary";
    grid-template-rows: auto 1fr;
    gap: var(--space-3) var(--space-6);
}

.article-link .thumbnail { grid-area: thumb; }

.article-link .thumbnail img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius);
}

.article-link-head { grid-area: head; }
.article-link h2 { font-size: var(--text-lg); }
.article-link h2 a { text-decoration: none; }

.article-link-summary {
    grid-area: summary;
    align-self: start;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

@media (max-width: 767px) {
    .article-link {
        grid-template-columns: 5.5rem minmax(0, 1fr);
        grid-template-areas:
            "thumb head"
            "summary summary";
        gap: var(--space-3) var(--space-4);
    }

    .article-link .thumbnail img { aspect-ratio: 1; }
    .article-link h2 { font-size: var(--text-md); }
}

@media (max-width: 400px) {
    .article-link { grid-template-columns: 4rem minmax(0, 1fr); }
    .article-link h2 { font-size: var(--text-base); }
}

/* Post hero image */
.thumbnail-img { width: auto; max-height: 22rem; border-radius: var(--radius); }
.prose > .thumbnail-img + * { margin-top: var(--space-5); }

/* CV header */
.cv-role { margin-top: var(--space-1); color: var(--color-muted); font-weight: 500; }
.cv-summary { max-width: var(--measure); margin-top: var(--space-3); }

.cv-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-5);
    margin-top: var(--space-4);
}

.cv-actions > a { display: inline-flex; align-items: center; gap: var(--space-2); }
.cv-pdf-button.button { padding: var(--space-2) var(--space-4); font-size: var(--text-sm); }

/* CV companies: a logo tile and name, ruled off from the roles below */
.prose > .company-hero { margin-top: var(--space-7); }
/* After a heading, CV blocks attach like prose does (skills rows bring their own 12px padding). */
.prose > :is(h2, h3) + :is(.company-hero, .position, .icon-title) { margin-top: var(--space-3); }

.company-hero {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.company-logo {
    display: none;
    width: 3.5rem;
    height: 3.5rem;
    object-fit: contain;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    /* The logos carry their own backgrounds, except Grazper's dark variant (a white mark). */
    background: var(--color-logo-tile);
}

:root:not([data-theme="dark"]) .company-logo-light,
[data-theme="dark"] .company-logo-dark { display: block; }
.company-hero .company-title { font-size: var(--text-lg); }

/* CV entries: roles, projects and degrees */
.prose > .position { margin-top: var(--space-5); }
.prose > .company-hero + .position { margin-top: var(--space-4); }
.prose > .position + * { margin-top: var(--space-2); }

.position {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-1) var(--space-4);
}

.position .position-title { color: var(--color-position-title); font-size: var(--text-base); }

/* Linked titles look like the others; a subtle underline marks the link. */
.position-title a { color: inherit; text-decoration-color: var(--color-border); }
.position-title a:hover { color: var(--color-accent); text-decoration-color: currentColor; }

.position-duration {
    color: var(--color-muted);
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.position-org { flex-basis: 100%; font-size: var(--text-sm); }
.position-org a { color: var(--color-muted); }

@media (max-width: 575px) {
    .position-duration { flex-basis: 100%; }
}

@media (max-width: 400px) {
    .cv-role .nowrap { white-space: normal; }
}

/* CV skills: one row per category, items as chips (bold = core) */
.prose > h2 + .skill-row, .prose > .skill-row + .skill-row { margin-top: 0; }

.skill-row {
    display: grid;
    grid-template-columns: 10rem minmax(0, 1fr);
    align-items: baseline;
    gap: var(--space-2) var(--space-4);
    padding-block: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}

.skill-row:has(+ hr) { border-bottom: 0; }

.skill-label {
    color: var(--color-muted);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.skill-chips ul {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: 0;
    list-style: none;
}

.skill-chips li {
    padding: calc(var(--space-1) / 2) var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-muted);
    font-size: var(--text-sm);
}

.skill-chips li:has(strong) { border-color: var(--color-border-strong); color: var(--color-text); }
.skill-chips strong { font-weight: 600; }

@media (max-width: 575px) {
    .skill-row { grid-template-columns: 1fr; }
}

/* CV "About me" titles */
.prose > .icon-title { margin-top: var(--space-5); }

.icon-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-base);
    font-weight: 600;
}

.icon-title .icon { color: var(--color-accent); }

/* 404 */
.not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
    padding-block: var(--space-6);
    text-align: center;
}

.not-found img { width: 8rem; }
.not-found-lead { color: var(--color-heading); font-size: var(--text-xl); font-weight: 700; }

/* ---------- Utilities ---------- */
.nowrap { white-space: nowrap; }
.muted { color: var(--color-muted); }
