/* ==========================================================================
   Eric Margay — Resume / CV
   Design tokens → base → layout → components → responsive → print
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;

    /* Light palette (default). Dark overrides live in one block further down. */
    --bg: #ffffff;
    --bg-subtle: #f5f7f9;
    --surface: #ffffff;
    --border: #e2e6ec;
    --border-strong: #c8cfd9;
    --text: #14181f;
    --text-muted: #565f6c;
    --text-faint: #7d8794;
    --accent: #2a44c9;
    --accent-hover: #1c31a3;
    --accent-soft: rgba(42, 68, 201, 0.08);
    --ring: rgba(42, 68, 201, 0.4);
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-md: 0 4px 16px -4px rgba(16, 24, 40, 0.12);
    --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, 0.18);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    --content-width: 1180px;
    --topbar-height: 60px;
    /* Single responsive gutter drives every horizontal margin on the page. */
    --gutter: clamp(18px, 4vw, 32px);

    color-scheme: light;
}

/* Dark by explicit toggle, or by system preference when no toggle has been set. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0e1116;
        --bg-subtle: #151a21;
        --surface: #151a21;
        --border: #252c37;
        --border-strong: #39424f;
        --text: #e6eaf0;
        --text-muted: #9aa5b3;
        --text-faint: #737e8c;
        --accent: #8ba4ff;
        --accent-hover: #a8bbff;
        --accent-soft: rgba(139, 164, 255, 0.13);
        --ring: rgba(139, 164, 255, 0.5);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 4px 16px -4px rgba(0, 0, 0, 0.5);
        --shadow-lg: 0 12px 32px -8px rgba(0, 0, 0, 0.6);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0e1116;
    --bg-subtle: #151a21;
    --surface: #151a21;
    --border: #252c37;
    --border-strong: #39424f;
    --text: #e6eaf0;
    --text-muted: #9aa5b3;
    --text-faint: #737e8c;
    --accent: #8ba4ff;
    --accent-hover: #a8bbff;
    --accent-soft: rgba(139, 164, 255, 0.13);
    --ring: rgba(139, 164, 255, 0.5);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px -4px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 32px -8px rgba(0, 0, 0, 0.6);
}

/* CV variants may change their editorial tone without forking the design system. */
:root[data-variant="education"] {
    --accent: #176b57;
    --accent-hover: #0f5142;
    --accent-soft: rgba(23, 107, 87, 0.09);
    --ring: rgba(23, 107, 87, 0.4);
}

@media (prefers-color-scheme: dark) {
    :root[data-variant="education"]:not([data-theme="light"]) {
        --accent: #76d6ba;
        --accent-hover: #9be4cf;
        --accent-soft: rgba(118, 214, 186, 0.13);
        --ring: rgba(118, 214, 186, 0.5);
    }
}

:root[data-theme="dark"][data-variant="education"] {
    --accent: #76d6ba;
    --accent-hover: #9be4cf;
    --accent-soft: rgba(118, 214, 186, 0.13);
    --ring: rgba(118, 214, 186, 0.5);
}

:root[data-variant="hardware"] {
    --accent: #a34816;
    --accent-hover: #7d3511;
    --accent-soft: rgba(163, 72, 22, 0.09);
    --ring: rgba(163, 72, 22, 0.4);
}

@media (prefers-color-scheme: dark) {
    :root[data-variant="hardware"]:not([data-theme="light"]) {
        --accent: #f0a36f;
        --accent-hover: #ffc39b;
        --accent-soft: rgba(240, 163, 111, 0.13);
        --ring: rgba(240, 163, 111, 0.5);
    }
}

:root[data-theme="dark"][data-variant="hardware"] {
    --accent: #f0a36f;
    --accent-hover: #ffc39b;
    --accent-soft: rgba(240, 163, 111, 0.13);
    --ring: rgba(240, 163, 111, 0.5);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */

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

html {
    scroll-behavior: smooth;
    /* Anchor targets clear the sticky bar instead of hiding behind it. */
    scroll-padding-top: calc(var(--topbar-height) + 16px);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.62;
    font-feature-settings: "kern" 1, "liga" 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Long URLs and identifiers wrap instead of widening the page on
       narrow screens. */
    overflow-wrap: break-word;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    line-height: 1.22;
    font-weight: 600;
    letter-spacing: -0.011em;
}

p {
    margin: 0;
}

ul,
ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

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

em {
    font-style: italic;
}

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

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

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* --------------------------------------------------------------------------
   3. Utilities
   -------------------------------------------------------------------------- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sprite {
    display: none;
}

/* Every icon in the page is a stroked line-art symbol from the inline sprite. */
.icon {
    width: 1em;
    height: 1em;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -0.14em;
}

.icon--sm {
    width: 0.82em;
    height: 0.82em;
    stroke-width: 2;
}

.muted {
    color: var(--text-muted);
}

.skip-link {
    position: absolute;
    top: -60px;
    left: 12px;
    z-index: 200;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 12px;
    color: #fff;
    text-decoration: none;
}

/* Bilingual toggle: exactly one language tree is rendered at a time. */
:root[data-lang="en"] .es,
:root[data-lang="es"] .en {
    display: none !important;
}

/* --------------------------------------------------------------------------
   4. Top bar
   -------------------------------------------------------------------------- */

.progress {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 60;
    height: 2px;
    pointer-events: none;
}

.progress span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width 0.1s linear;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.topbar__inner {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: var(--content-width);
    min-height: var(--topbar-height);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.topbar__brand {
    display: flex;
    flex-direction: column;
    flex: none;
    color: var(--text);
    line-height: 1.2;
}

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

.topbar__brand-name {
    font-family: var(--font-serif);
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.topbar__brand:hover .topbar__brand-name {
    color: var(--accent);
}

.topbar__brand-role {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 400;
    color: var(--text-faint);
    letter-spacing: 0.02em;
}

.topbar__nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    overflow-x: auto;
    scrollbar-width: none;
}

.topbar__nav::-webkit-scrollbar {
    display: none;
}

.topbar__nav a {
    flex: none;
    padding: 6px 11px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.83rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.topbar__nav a:hover {
    background: var(--bg-subtle);
    color: var(--text);
    text-decoration: none;
}

.topbar__nav a.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.87rem;
    font-weight: 550;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

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

.btn--solid {
    background: var(--accent);
    color: #fff;
}

.btn--solid:hover {
    background: var(--accent-hover);
    color: #fff;
    text-decoration: none;
}

.btn--ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
}

.btn--ghost:hover {
    background: var(--bg-subtle);
    border-color: var(--text-faint);
    color: var(--text);
    text-decoration: none;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
    background: var(--bg-subtle);
    color: var(--text);
    border-color: var(--border-strong);
}

/* The toggle shows the mode it switches *to*: moon while light, sun while dark. */
.icon--sun {
    display: none;
}

.icon--moon {
    display: block;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon--sun {
        display: block;
    }

    :root:not([data-theme="light"]) .icon--moon {
        display: none;
    }
}

:root[data-theme="dark"] .icon--sun {
    display: block;
}

:root[data-theme="dark"] .icon--moon {
    display: none;
}

:root[data-theme="light"] .icon--sun {
    display: none;
}

:root[data-theme="light"] .icon--moon {
    display: block;
}

.lang-switch {
    display: flex;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
}

.lang-switch button {
    padding: 4px 9px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-faint);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.lang-switch button:hover {
    color: var(--text);
}

.lang-switch button[aria-pressed="true"] {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 40;
    display: none;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
}

.fab:hover {
    background: var(--accent-hover);
}

/* --------------------------------------------------------------------------
   6. Hero
   -------------------------------------------------------------------------- */

main {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.hero {
    padding: 56px 0 40px;
    border-bottom: 1px solid var(--border);
}

.hero__eyebrow {
    margin-bottom: 14px;
    color: var(--text-faint);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero__name {
    font-family: var(--font-serif);
    font-size: clamp(2.6rem, 7vw, 4rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.02;
    text-wrap: balance;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.hero__role {
    margin-top: 8px;
    color: var(--accent);
    font-size: clamp(1.02rem, 2.4vw, 1.2rem);
    font-weight: 550;
    letter-spacing: -0.005em;
    text-wrap: balance;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.hero__summary {
    width: 100%;
    max-width: none;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.72;
    text-align: justify;
    text-justify: inter-word;
    text-wrap: pretty;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
    -webkit-hyphens: none;
}

.contact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin-top: 26px;
}

.contact li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.contact li .icon {
    color: var(--text-faint);
    font-size: 0.95rem;
}

.contact a {
    color: var(--text-muted);
}

.contact li:hover {
    border-color: var(--border-strong);
}

.contact li:hover a,
.contact li:hover .icon {
    color: var(--accent);
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
}

/* --------------------------------------------------------------------------
   7. Layout
   -------------------------------------------------------------------------- */

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

@media (min-width: 1000px) {
    .layout {
        grid-template-columns: minmax(0, 1fr) 300px;
        gap: 56px;
    }

    /* The sidebar rides along while the long experience column scrolls.
       Its scrollbar is hidden — the content still scrolls, it just does not
       draw a track next to the cards. */
    .layout__aside {
        position: sticky;
        top: calc(var(--topbar-height) + 24px);
        align-self: start;
        max-height: calc(100vh - var(--topbar-height) - 48px);
        overflow-y: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .layout__aside::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }
}

.section {
    margin-bottom: 52px;
}

.section:last-child {
    margin-bottom: 0;
}

.section__title {
    margin-bottom: 6px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--text);
    font-family: var(--font-serif);
    font-size: 1.42rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.section__note {
    margin: 14px 0 0;
    color: var(--text-faint);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   8. Timeline entries
   -------------------------------------------------------------------------- */

.timeline {
    margin-top: 28px;
    padding-left: 26px;
    border-left: 1px solid var(--border);
}

.entry {
    position: relative;
    padding-bottom: 34px;
}

.entry:last-child {
    padding-bottom: 0;
}

/* Node on the rail, aligned with the first line of the organisation name. */
.entry::before {
    content: "";
    position: absolute;
    top: 7px;
    left: -31px;
    width: 9px;
    height: 9px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    background: var(--bg);
}

.entry__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 18px;
}

.entry__org {
    font-size: 1.06rem;
    font-weight: 650;
    letter-spacing: -0.012em;
}

.entry__org a {
    color: var(--text);
}

.entry__org a:hover {
    color: var(--accent);
    text-decoration: none;
}

.entry__org-sub {
    display: inline;
    color: var(--text-faint);
    font-size: 0.86rem;
    font-weight: 450;
}

.entry__org-sub::before {
    content: " · ";
}

.entry__org-sub a {
    color: var(--text-faint);
}

.entry__date {
    flex: none;
    color: var(--text-faint);
    font-size: 0.79rem;
    font-weight: 550;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.entry__role {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.91rem;
    font-weight: 500;
}

.bullets {
    margin-top: 12px;
}

.bullets li {
    position: relative;
    padding-left: 17px;
    margin-bottom: 7px;
    color: var(--text-muted);
    font-size: 0.925rem;
    line-height: 1.66;
}

.bullets li:last-child {
    margin-bottom: 0;
}

.bullets li::before {
    content: "";
    position: absolute;
    top: 0.66em;
    left: 2px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--border-strong);
}

.ext {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85em;
    font-weight: 550;
    white-space: nowrap;
}

/* Verifiable credential badge (professional licence registry number). */
.credential {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 3px 8px;
    margin-top: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    font-size: 0.83rem;
}

.credential__label {
    color: var(--text-faint);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
}

.credential__id {
    color: var(--text);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.credential__issuer {
    color: var(--text-faint);
}

/* Verified certificates: pill list where each item links to its credential. */
.certs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 12px;
}

.certs li {
    display: flex;
}

.certs a {
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: 0.775rem;
    font-weight: 550;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.certs a:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    text-decoration: none;
}

/* Cited work keeps its original Spanish title, set apart from the summary. */
.paper-title {
    color: var(--text) !important;
    font-weight: 600;
    font-style: italic;
    text-align: left !important;
}

/* Collapsible overflow detail, so the default view stays Harvard-length. */
.more {
    margin-top: 12px;
}

.more summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-faint);
    font-size: 0.78rem;
    font-weight: 550;
    cursor: pointer;
    list-style: none;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.more summary::-webkit-details-marker {
    display: none;
}

.more summary::after {
    content: "+";
    font-size: 0.95rem;
    line-height: 1;
}

.more[open] summary::after {
    content: "–";
}

.more summary:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.more .bullets {
    margin-top: 10px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 14px;
}

.tags li {
    padding: 3px 9px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    color: var(--text-faint);
    font-size: 0.735rem;
    font-weight: 550;
    letter-spacing: 0.005em;
}

.timeline--compact .entry {
    padding-bottom: 26px;
}

/* --------------------------------------------------------------------------
   9. Sidebar cards
   -------------------------------------------------------------------------- */

.card {
    padding: 22px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.card:last-child {
    margin-bottom: 0;
}

.card__title {
    margin-bottom: 16px;
    font-family: var(--font-serif);
    font-size: 1.08rem;
    font-weight: 600;
}

.skill-group {
    margin-bottom: 15px;
}

.skill-group:last-child {
    margin-bottom: 0;
}

.skill-group h3 {
    margin-bottom: 3px;
    color: var(--text-faint);
    font-size: 0.7rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.skill-group p {
    color: var(--text-muted);
    font-size: 0.865rem;
    line-height: 1.6;
}

.plain li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.plain li:last-child {
    margin-bottom: 0;
}

.plain .muted {
    font-size: 0.82rem;
}

.awards li {
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.awards li:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: 0;
}

.awards h3 {
    font-size: 0.895rem;
    font-weight: 600;
}

.awards__meta {
    margin: 2px 0 5px;
    color: var(--text-faint);
    font-size: 0.775rem;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   10. Footer
   -------------------------------------------------------------------------- */

.footer {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 26px var(--gutter) 40px;
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-size: 0.83rem;
}

.footer__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 4px;
    font-size: 0.79rem;
}

/* --------------------------------------------------------------------------
   11. Scroll reveal
   The hidden state is scoped to .js, which the inline <head> script sets
   before first paint. Without JavaScript nothing is ever hidden.
   -------------------------------------------------------------------------- */

.js .section__title,
.js .section__note,
.js .entry,
.js .card {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s cubic-bezier(0.22, 0.61, 0.36, 1),
        transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
    /* Promote only while animating; cleared once revealed. */
    will-change: opacity, transform;
}

.js .section__title.is-revealed,
.js .section__note.is-revealed,
.js .entry.is-revealed,
.js .card.is-revealed {
    opacity: 1;
    transform: none;
    will-change: auto;
}

/* Bullets cascade in after their entry lands. nth-child counts both language
   copies, so the visible half lands on an even 80ms rhythm. */
.js .entry .bullets > li,
.js .entry .tags > li {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.js .entry.is-revealed .bullets > li,
.js .entry.is-revealed .tags > li {
    opacity: 1;
    transform: none;
}

.js .entry.is-revealed .bullets > li:nth-child(1) { transition-delay: 0.08s; }
.js .entry.is-revealed .bullets > li:nth-child(2) { transition-delay: 0.12s; }
.js .entry.is-revealed .bullets > li:nth-child(3) { transition-delay: 0.16s; }
.js .entry.is-revealed .bullets > li:nth-child(4) { transition-delay: 0.20s; }
.js .entry.is-revealed .bullets > li:nth-child(5) { transition-delay: 0.24s; }
.js .entry.is-revealed .bullets > li:nth-child(6) { transition-delay: 0.28s; }
.js .entry.is-revealed .bullets > li:nth-child(7) { transition-delay: 0.32s; }
.js .entry.is-revealed .bullets > li:nth-child(8) { transition-delay: 0.36s; }
.js .entry.is-revealed .bullets > li:nth-child(9) { transition-delay: 0.40s; }
.js .entry.is-revealed .bullets > li:nth-child(10) { transition-delay: 0.44s; }
.js .entry.is-revealed .bullets > li:nth-child(n+11) { transition-delay: 0.48s; }
.js .entry.is-revealed .tags > li { transition-delay: 0.5s; }

/* The timeline node pops once its entry arrives. */
.js .entry::before {
    transform: scale(0.4);
    opacity: 0;
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    transition-delay: 0.1s;
}

.js .entry.is-revealed::before {
    transform: scale(1);
    opacity: 1;
}

/* Motion is decoration only: anyone who opts out, and every printed page,
   gets the fully settled layout with no transitions at all. */
@media (prefers-reduced-motion: reduce) {

    .js .section__title,
    .js .section__note,
    .js .entry,
    .js .card,
    .js .entry .bullets > li,
    .js .entry .tags > li,
    .js .entry::before {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* --------------------------------------------------------------------------
   12. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
    .topbar__nav {
        display: none;
    }

    .topbar__brand {
        margin-right: auto;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 14.5px;
    }

    .hero {
        padding: 34px 0 30px;
    }

    .topbar__brand-role,
    .topbar__print {
        display: none;
    }

    .fab {
        display: flex;
    }

    .contact {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .hero__actions .btn {
        flex: 1 1 auto;
    }

    .layout {
        padding-top: 30px;
        gap: 34px;
    }

    .timeline {
        padding-left: 20px;
    }

    .entry::before {
        left: -25px;
    }

    .entry__date {
        font-size: 0.75rem;
    }

    .card {
        padding: 18px;
    }
}

/* --------------------------------------------------------------------------
   13. Print — single-column, Harvard-style, ATS friendly
   -------------------------------------------------------------------------- */
@media print {

    /* Nothing may reach paper mid-animation: reset every reveal state first. */
    .js .section__title,
    .js .section__note,
    .js .entry,
    .js .card,
    .js .entry .bullets > li,
    .js .entry .tags > li,
    .js .entry::before {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }

    @page {
        size: Letter;
        /* A real printable safe area. Keeping this in @page (instead of on
           main) makes the margin repeat correctly on every PDF page. */
        margin: 16mm 17mm 17mm;
    }

    /* Backgrounds and borders are part of the design here (tags, rules), so
       they must survive the browser's default "economy" colour stripping. */
    *,
    *::before,
    *::after {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    :root,
    :root[data-theme="dark"] {
        /* Force the light palette regardless of the on-screen theme, with a
           deep indigo accent that stays legible in greyscale. */
        color-scheme: light !important;
        --bg: #ffffff !important;
        --bg-subtle: #f4f5f8 !important;
        --surface: #ffffff !important;
        --border: #c9cfd9 !important;
        --border-strong: #8d95a3 !important;
        --text: #101319 !important;
        --text-muted: #23272f !important;
        --text-faint: #545b66 !important;
        --accent: #1e3a8a !important;
        --shadow-sm: none !important;
        --shadow-md: none !important;
        --shadow-lg: none !important;
    }

    /* Preserve each CV's identity while keeping its printable palette light. */
    :root[data-variant="education"],
    :root[data-theme="dark"][data-variant="education"] {
        --accent: #176b57 !important;
    }

    :root[data-variant="hardware"],
    :root[data-theme="dark"][data-variant="hardware"] {
        --accent: #a34816 !important;
    }

    html {
        scroll-padding-top: 0;
        background: #ffffff !important;
    }

    body {
        margin: 0;
        background: #ffffff !important;
        color: var(--text);
        font-size: 9.7pt;
        line-height: 1.5;
        overflow: visible;
        orphans: 3;
        widows: 3;
    }

    /* The printed sheet stays at Harvard length: the collapsible overflow
       detail is web-only, so paper keeps 4–6 bullets per role. */
    .topbar,
    .progress,
    .fab,
    .skip-link,
    .hero__actions,
    .hero__eyebrow,
    .footer,
    .more {
        display: none !important;
    }

    main {
        max-width: none;
        padding: 0;
    }

    /* ---------------------------------------------------------------- Header */

    .hero {
        padding: 0 0 10pt;
        border-bottom: 1.5pt solid var(--accent);
    }

    .hero__name {
        font-size: 25pt;
        line-height: 1;
        letter-spacing: -0.02em;
        color: var(--text);
    }

    .hero__role {
        margin-top: 3pt;
        font-size: 11pt;
        font-weight: 600;
        color: var(--accent);
    }

    .hero__summary {
        max-width: none;
        margin-top: 7pt;
        font-size: 9.5pt;
        line-height: 1.5;
        color: var(--text-muted);
        text-align: justify;
        text-justify: inter-word;
        hyphens: none;
        -webkit-hyphens: none;
    }

    /* Contact collapses to one dense, evenly separated line. */
    .contact {
        display: block;
        gap: 0;
        margin-top: 8pt;
        font-size: 9pt;
        color: var(--text-muted);
    }

    .contact li {
        display: inline;
        padding: 0;
        border: 0;
        background: none;
        font-size: inherit;
    }

    .contact li + li::before {
        content: " · ";
        color: var(--border-strong);
    }

    .contact li .icon {
        display: none;
    }

    .contact a {
        color: var(--text-muted);
    }

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

    /* One column: the sidebar flows below the main sections. */
    .layout {
        display: block;
        padding: 12pt 0 0;
    }

    .layout__aside {
        position: static;
        max-height: none;
        overflow: visible;
        margin-top: 14pt;
    }

    .section {
        margin-bottom: 13pt;
        break-inside: auto;
        page-break-inside: auto;
    }

    .section__title,
    .card__title {
        margin-bottom: 0;
        padding-bottom: 2.5pt;
        border-bottom: 1pt solid var(--accent);
        font-size: 13pt;
        font-weight: 600;
        color: var(--text);
        break-after: avoid;
        page-break-after: avoid;
    }

    .section__note {
        display: block;
        margin: 5pt 0 0;
        font-size: 8.8pt;
        font-style: italic;
        color: var(--text-faint);
        break-after: avoid;
    }

    /* ---------------------------------------------------------------- Entries */

    .timeline {
        margin-top: 9pt;
        padding-left: 0;
        border-left: 0;
    }

    .entry {
        padding-bottom: 9pt;
        /* Long roles (especially Waltem) are allowed to continue naturally.
           Their atomic children below remain indivisible, avoiding clipping
           while still preventing awkward splits inside a bullet or badge. */
        break-inside: auto;
        page-break-inside: auto;
    }

    .entry::before {
        display: none;
    }

    .entry__head {
        display: grid;
        grid-template-columns: minmax(0, 1fr) max-content;
        align-items: start;
        gap: 0 12pt;
        break-inside: avoid;
        page-break-inside: avoid;
        break-after: avoid;
        page-break-after: avoid;
    }

    .entry__org {
        font-size: 10.4pt;
        font-weight: 700;
        color: var(--text);
        break-after: avoid;
    }

    .entry__org a {
        color: var(--text);
    }

    .entry__org-sub,
    .entry__org-sub a {
        font-size: 9pt;
        font-weight: 400;
        color: var(--text-faint);
    }

    .entry__date {
        font-size: 8.5pt;
        font-weight: 600;
        color: var(--accent);
        white-space: nowrap;
        text-align: right;
    }

    .entry__role {
        margin-top: 1pt;
        font-size: 9.4pt;
        font-style: italic;
        font-weight: 500;
        color: var(--text-muted);
        break-after: avoid;
        page-break-after: avoid;
    }

    .bullets {
        margin-top: 5pt;
        break-before: avoid;
        page-break-before: avoid;
    }

    .bullets li {
        margin-bottom: 2.5pt;
        padding-left: 11pt;
        font-size: 9.5pt;
        line-height: 1.46;
        color: var(--text-muted);
        text-align: justify;
        hyphens: auto;
        break-inside: avoid;
        page-break-inside: avoid;
        orphans: 2;
        widows: 2;
    }

    .bullets li::before {
        top: 0.58em;
        left: 1.5pt;
        width: 2.8pt;
        height: 2.8pt;
        background: var(--accent);
    }

    /* Inline reference links are noise on paper — the URLs are unusable in
       print and the destinations are all listed on the live page. */
    .ext,
    .ext .icon {
        display: none;
    }

    /* The licence number is the one credential a recruiter can verify against a
       public registry, so it keeps its badge treatment on paper. */
    .credential {
        gap: 2pt 6pt;
        margin-top: 5pt;
        padding: 3pt 6pt;
        border: 0.5pt solid var(--border);
        border-left: 2pt solid var(--accent);
        border-radius: 2pt;
        background: var(--bg-subtle);
        font-size: 8.6pt;
        break-inside: avoid;
    }

    .credential__label {
        font-size: 7.4pt;
        color: var(--accent);
    }

    .credential__id {
        color: var(--text);
    }

    .credential__issuer {
        color: var(--text-faint);
    }

    .paper-title {
        font-size: 9.6pt;
        text-align: left !important;
        hyphens: none;
    }

    /* Certificate pills survive to paper, minus their (unusable) hyperlinks. */
    .certs {
        gap: 2.5pt;
        margin-top: 4pt;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .certs a {
        padding: 1pt 4.5pt;
        border: 0.5pt solid var(--border);
        border-radius: 2.5pt;
        background: var(--bg-subtle);
        color: var(--text-muted);
        font-size: 7.8pt;
        font-weight: 600;
    }

    /* Tags stay real pills on paper rather than collapsing to a text run. */
    .tags {
        display: flex;
        flex-wrap: wrap;
        gap: 2.5pt;
        margin-top: 5pt;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .tags li {
        display: inline-block;
        padding: 1pt 4.5pt;
        border: 0.65pt solid #8d95a3 !important;
        border-radius: 2.5pt;
        /* Deliberately white: this stays readable even when a browser ignores
           background-graphics preferences or prints a dark screen theme. */
        background: #ffffff !important;
        color: #23272f !important;
        font-size: 7.6pt;
        font-weight: 600;
        line-height: 1.5;
        box-shadow: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .timeline--compact .entry {
        padding-bottom: 7pt;
    }

    /* ---------------------------------------------------------------- Sidebar */

    /* Cards may flow across a page boundary; the atomic units are the
       individual skill groups and award items, which never split. */
    .card {
        padding: 0;
        margin-bottom: 12pt;
        border: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
        break-inside: auto;
        page-break-inside: auto;
    }

    .card__title {
        margin-bottom: 5pt;
    }

    /* On paper each skill group is a label/value row rather than two stacked
       lines — same content, roughly half the vertical space. */
    #skills .skill-group {
        display: grid;
        grid-template-columns: 96pt 1fr;
        gap: 0 9pt;
        margin-bottom: 3pt;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    #skills .skill-group h3 {
        margin: 0;
        padding-top: 0.8pt;
        font-size: 7.8pt;
        font-weight: 700;
        color: var(--accent);
    }

    #skills .skill-group p {
        font-size: 9pt;
        line-height: 1.42;
        color: var(--text-muted);
    }

    #languages .plain li {
        display: inline;
        font-size: 9pt;
    }

    #languages .plain li + li::before {
        content: " · ";
        color: var(--border-strong);
    }

    #awards ul {
        column-count: 2;
        column-gap: 18pt;
    }

    .awards li {
        padding-bottom: 5pt;
        margin-bottom: 5pt;
        border-bottom: 0;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .awards h3 {
        font-size: 9.3pt;
        font-weight: 650;
        color: var(--text);
    }

    .awards__meta {
        margin: 0;
        font-size: 8.5pt;
        color: var(--text-faint);
    }

    a {
        text-decoration: none;
    }
}
