/* The portfolio's paper and inks. Cream by default; html[data-theme="dark"] is espresso. */
:root {
    --paper: #f4ecde;
    --sheet: 251, 247, 239;
    --ink: #211e19;
    --muted: #6b6256;
    --faint: #9d9386;
    --rule: #d8cebc;
    --accent: #8e7d67;
    --primary: #322d26;
    --on-primary: #f4ecde;
    --bar: rgba(232, 220, 199, 0.9);
    --tape: rgba(201, 189, 167, 0.62);
    --shadow: 40, 26, 14;
    --texture: url('assets/handmade-paper.jpg');
    --texture-veil: rgba(244, 236, 222, 0);
    color-scheme: light;
}

:root[data-theme='dark'] {
    --paper: #171512;
    --sheet: 33, 31, 27;
    --ink: #f8f3ea;
    --muted: #b9b0a2;
    --faint: #81786c;
    --rule: #4b463e;
    --accent: #c9bda7;
    --primary: #f3eadb;
    --on-primary: #171512;
    --bar: rgba(23, 21, 18, 0.9);
    --tape: rgba(201, 189, 167, 0.28);
    --shadow: 0, 0, 0;
    --texture: url('assets/dark-handmade-paper-1040.jpg');
    --texture-veil: rgba(23, 21, 18, 0.38);
    color-scheme: dark;
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background-color: var(--paper);
    background-image: linear-gradient(var(--texture-veil), var(--texture-veil)), var(--texture);
    background-size: 100% 100%, 520px auto;
    color: var(--ink);
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: inherit;
}

img {
    display: block;
}

svg {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

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

/* Top bar: the portfolio's nav, lowercase and bold. */
.topbar {
    align-items: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: var(--bar);
    border-bottom: 1px solid var(--rule);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 0.7rem max(1.25rem, calc((100vw - 1120px) / 2));
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    align-items: center;
    display: flex;
    gap: 0.45rem;
    text-decoration: none;
}

.brand-mark {
    display: block;
    flex: none;
    height: 40px;
    width: 40px;
}

.brand-mark img {
    height: 100%;
    width: 100%;
}

.brand-mark--small {
    height: 18px;
    width: 18px;
}

:root[data-theme='dark'] .brand-mark img {
    filter: invert(1) brightness(1.2);
}

.brand-wordmark {
    color: var(--primary);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1;
}

.brand:hover .brand-wordmark {
    color: var(--accent);
}

.nav {
    align-items: center;
    display: flex;
}

.nav-link {
    align-items: center;
    color: var(--muted);
    display: inline-flex;
    font-size: 0.9rem;
    font-weight: 700;
    gap: 0.35rem;
    letter-spacing: 0.5px;
    padding: 0.5rem 0.9rem;
    position: relative;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-link::after {
    background: var(--primary);
    bottom: 0.2rem;
    content: '';
    height: 2px;
    left: 50%;
    position: absolute;
    transform: translateX(-50%);
    transition: width 0.3s ease;
    width: 0;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link:hover::after {
    width: 70%;
}

.nav-link svg {
    height: 15px;
    stroke-width: 2.2;
    width: 15px;
}

.theme-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    border-left: 1px solid var(--rule);
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    gap: 0.5rem;
    letter-spacing: 0.5px;
    margin-left: 0.5rem;
    padding: 0.5rem 0 0.5rem 1.1rem;
    transition: color 0.3s ease;
}

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

.theme-toggle-dot {
    background: linear-gradient(90deg, currentColor 50%, transparent 50%);
    border: 2px solid currentColor;
    border-radius: 50%;
    display: inline-block;
    height: 0.8rem;
    transition: transform 0.4s cubic-bezier(0.645, 0.045, 0.355, 1);
    width: 0.8rem;
}

:root[data-theme='dark'] .theme-toggle-dot {
    transform: rotate(180deg);
}

/* cv.js clips the new theme to a growing ink blot. */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-new(root) {
    z-index: 2;
}

/* The desk and the sheet laid on it. */
.desk {
    padding: 3rem 1.25rem 2.5rem;
}

.sheet {
    background-color: rgb(var(--sheet));
    background-image: linear-gradient(rgba(var(--sheet), 0.86), rgba(var(--sheet), 0.86)), var(--texture);
    background-size: 100% 100%, 520px auto;
    border-radius: 3px;
    box-shadow:
        0 1px 1px rgba(var(--shadow), 0.06),
        0 18px 36px -22px rgba(var(--shadow), 0.42),
        0 46px 70px -46px rgba(var(--shadow), 0.4);
    margin: 0 auto;
    max-width: 920px;
    padding: 3.5rem 4rem 2.25rem;
    position: relative;
}

/* On espresso paper the sheet needs a faint edge to stand off the desk. */
:root[data-theme='dark'] .sheet {
    box-shadow:
        0 0 0 1px rgba(243, 234, 219, 0.06),
        0 18px 36px -22px rgba(0, 0, 0, 0.7),
        0 46px 70px -46px rgba(0, 0, 0, 0.6);
}

/* Lifted corners: two soft shadows tucked under the bottom edge. */
.sheet::before,
.sheet::after {
    bottom: 14px;
    box-shadow: 0 16px 14px rgba(var(--shadow), 0.22);
    content: '';
    height: 20%;
    position: absolute;
    width: 42%;
    z-index: -1;
}

.sheet::before {
    left: 12px;
    transform: rotate(-2.4deg);
}

.sheet::after {
    right: 12px;
    transform: rotate(2.4deg);
}

/* Masthead */
.masthead {
    align-items: start;
    border-bottom: 1px solid var(--rule);
    display: grid;
    gap: 2rem;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 2.25rem;
    padding-bottom: 2rem;
}

.kicker {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    margin-bottom: 0.65rem;
    text-transform: uppercase;
}

.name {
    font-size: clamp(2.1rem, 5vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.02;
}

.name span {
    color: var(--accent);
    display: block;
}

.headline {
    color: var(--muted);
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0.9rem;
}

.contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1.4rem;
    list-style: none;
    margin-top: 1.1rem;
}

.contacts a {
    align-items: center;
    color: var(--ink);
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: 600;
    gap: 0.45rem;
    text-decoration: none;
    text-decoration-color: var(--rule);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 4px;
}

.contacts a:hover {
    text-decoration-line: underline;
}

.contacts svg {
    color: var(--accent);
    flex: none;
    height: 15px;
    width: 15px;
}

/* A studio portrait taped to the corner of the sheet. Screen only. */
.snapshot {
    background: #fffdf8;
    box-shadow: 0 10px 22px -12px rgba(var(--shadow), 0.55), 0 1px 2px rgba(var(--shadow), 0.18);
    padding: 7px 7px 26px;
    position: relative;
    transform: rotate(2.6deg);
    width: 150px;
}

:root[data-theme='dark'] .snapshot {
    background: #ece4d6;
}

.snapshot img {
    aspect-ratio: 4 / 5;
    height: auto;
    object-fit: cover;
    object-position: 50% 18%;
    width: 100%;
}

.tape {
    background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255, 255, 255, 0.18) 6px 9px), var(--tape);
    height: 22px;
    left: 50%;
    position: absolute;
    top: -11px;
    transform: translateX(-50%) rotate(-5deg);
    width: 76px;
    -webkit-mask: linear-gradient(90deg, transparent 0 2px, #000 2px calc(100% - 2px), transparent calc(100% - 2px));
    mask: linear-gradient(90deg, transparent 0 2px, #000 2px calc(100% - 2px), transparent calc(100% - 2px));
}

/* Columns */
.columns {
    display: grid;
    gap: 3rem;
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
}

.side-column {
    border-left: 1px solid var(--rule);
    padding-left: 2.25rem;
}

.block + .block {
    margin-top: 2rem;
}

/* Section headings: lowercase and bold, with the portfolio's short bar underneath. */
.heading {
    display: inline-block;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.2;
    margin-bottom: 1.35rem;
    position: relative;
}

.heading::after {
    background: var(--primary);
    bottom: -8px;
    content: '';
    height: 3px;
    left: 0;
    position: absolute;
    width: 32px;
}

.entry + .entry {
    margin-top: 1.5rem;
}

.entry-head {
    align-items: baseline;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.entry-title {
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.35;
}

.entry-aside {
    color: var(--muted);
    font-size: 0.86em;
    font-weight: 500;
}

.entry-date {
    color: var(--muted);
    flex: none;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}

.entry-role {
    color: var(--ink);
    font-size: 0.9rem;
    margin-top: 0.1rem;
}

.entry-role em {
    font-style: italic;
    font-weight: 500;
}

.entry-place {
    color: var(--muted);
    font-size: 0.86em;
    font-weight: 500;
}

.entry-place::before {
    color: var(--faint);
    content: '·';
    margin: 0 0.5rem;
}

.entry--compact .entry-date {
    margin-top: 0.2rem;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    list-style: none;
    margin-top: 0.55rem;
}

.tags li {
    border: 1px solid var(--rule);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.5;
    padding: 0.08rem 0.55rem;
}

.tags--solid li {
    background: rgba(var(--sheet), 0.6);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    color: var(--ink);
}

.points {
    list-style: none;
    margin-top: 0.7rem;
}

.points li {
    font-size: 0.88rem;
    line-height: 1.62;
    padding-left: 1.05rem;
    position: relative;
}

.points li + li {
    margin-top: 0.35rem;
}

/* An ink dash instead of a bullet. */
.points li::before {
    background: var(--accent);
    border-radius: 1px;
    content: '';
    height: 1.5px;
    left: 0;
    position: absolute;
    top: 0.8em;
    width: 7px;
}

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

.skill-label {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.skill-group .tags {
    margin-top: 0.35rem;
}

.skill-text {
    font-size: 0.86rem;
    font-weight: 500;
    margin-top: 0.15rem;
}

.certs {
    list-style: none;
}

.certs li + li {
    margin-top: 0.75rem;
}

.certs strong {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.4;
}

.certs span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 500;
}

.sheet-foot {
    align-items: center;
    border-top: 1px dashed var(--rule);
    color: var(--muted);
    display: flex;
    font-size: 0.72rem;
    font-weight: 600;
    gap: 0.45rem;
    justify-content: center;
    letter-spacing: 0.04em;
    margin-top: 2.25rem;
    padding-top: 1rem;
}

/* Under the sheet */
.actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    justify-content: center;
    margin-top: 2.25rem;
}

.button {
    align-items: center;
    background: var(--primary);
    border-radius: 999px;
    box-shadow: 0 10px 22px -14px rgba(var(--shadow), 0.7);
    color: var(--on-primary);
    display: inline-flex;
    font-size: 0.95rem;
    font-weight: 700;
    gap: 0.55rem;
    letter-spacing: 0.5px;
    padding: 0.8rem 1.6rem;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button:hover {
    box-shadow: 0 14px 26px -14px rgba(var(--shadow), 0.8);
    transform: translateY(-2px);
}

.button svg {
    height: 17px;
    stroke-width: 2.2;
    width: 17px;
}

.text-button {
    background: none;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-decoration: underline;
    text-decoration-color: var(--rule);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 4px;
}

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

.page-foot {
    color: var(--muted);
    display: flex;
    font-size: 0.85rem;
    font-weight: 700;
    gap: 1.5rem;
    justify-content: center;
    letter-spacing: 0.5px;
    padding: 0 1.25rem calc(2.5rem + env(safe-area-inset-bottom));
}

.page-foot a {
    text-decoration: none;
}

.page-foot a:hover {
    color: var(--primary);
}

@media (max-width: 860px) {
    .sheet {
        padding: 2.75rem 2.5rem 2rem;
    }

    .columns {
        gap: 2.25rem;
        grid-template-columns: minmax(0, 1fr);
    }

    .side-column {
        border-left: 0;
        border-top: 1px solid var(--rule);
        display: grid;
        gap: 2rem;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        padding-left: 0;
        padding-top: 2.25rem;
    }

    .side-column .block + .block {
        margin-top: 0;
    }
}

@media (max-width: 640px) {
    .nav-link--wide {
        display: none;
    }

    /* At the top of the page, scrolling away with it, so it never sits over the CV. */
    .topbar {
        padding-bottom: 0.55rem;
        padding-top: 0.55rem;
        position: relative;
    }

    .brand-mark {
        height: 34px;
        width: 34px;
    }

    .brand-wordmark {
        font-size: 1.15rem;
    }

    .desk {
        padding: 1.25rem 0.75rem 2rem;
    }

    .sheet {
        padding: 2rem 1.35rem 1.5rem;
    }

    /* The photo sits beside the kicker so the name gets the whole width. */
    .masthead {
        column-gap: 1rem;
        margin-bottom: 1.75rem;
        padding-bottom: 1.5rem;
        row-gap: 0;
    }

    .masthead-text {
        display: contents;
    }

    .kicker {
        align-self: end;
        grid-column: 1;
        grid-row: 1;
        margin-bottom: 0.9rem;
    }

    .snapshot {
        grid-column: 2;
        grid-row: 1;
        margin: 0 -0.2rem 1rem 0;
        padding: 5px 5px 16px;
        width: 86px;
    }

    .name,
    .headline,
    .contacts {
        grid-column: 1 / -1;
    }

    .name {
        font-size: clamp(1.8rem, 9vw, 2.3rem);
    }

    .tape {
        height: 16px;
        top: -8px;
        width: 54px;
    }

    .headline {
        font-size: 0.92rem;
    }

    .contacts {
        flex-direction: column;
        grid-column: 1 / -1;
    }

    .entry-head {
        flex-direction: column;
        gap: 0;
    }

    .entry-date {
        order: -1;
    }

    .points li {
        font-size: 0.86rem;
    }
}

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

/* Print and the PDF: one A4 page, white paper, the same type and rules. */
@page {
    margin: 0;
    size: A4;
}

@media print {
    :root,
    :root[data-theme='dark'] {
        --sheet: 255, 255, 255;
        --ink: #211e19;
        --muted: #5f574b;
        --faint: #9d9386;
        --rule: #ddd3c3;
        --accent: #8e7d67;
        --primary: #322d26;
        color-scheme: light;
    }

    html,
    body {
        background: #fff;
        font-size: 9pt;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .topbar,
    .actions,
    .page-foot,
    .snapshot {
        display: none;
    }

    .desk {
        padding: 0;
    }

    .sheet {
        background: #fff;
        border-radius: 0;
        box-shadow: none;
        max-width: none;
        padding: 11mm 13mm 8mm;
        width: 210mm;
    }

    .sheet::before,
    .sheet::after {
        display: none;
    }

    :root[data-theme='dark'] .brand-mark img {
        filter: none;
    }

    .masthead {
        display: block;
        margin-bottom: 4.5mm;
        padding-bottom: 4mm;
    }

    .kicker {
        font-size: 6.4pt;
        margin-bottom: 1.6mm;
    }

    .name {
        font-size: 23pt;
    }

    .name span {
        display: inline;
    }

    .headline {
        font-size: 9.2pt;
        margin-top: 1.6mm;
    }

    .contacts {
        gap: 1mm 5mm;
        margin-top: 2.4mm;
    }

    .contacts a {
        font-size: 7.9pt;
    }

    .contacts svg {
        height: 9pt;
        width: 9pt;
    }

    .columns {
        gap: 6mm;
        grid-template-columns: minmax(0, 2.45fr) minmax(0, 1fr);
    }

    .side-column {
        border-left: 1px solid var(--rule);
        border-top: 0;
        display: block;
        padding-left: 5mm;
        padding-top: 0;
    }

    .side-column .block + .block,
    .block + .block {
        margin-top: 4.4mm;
    }

    .heading {
        font-size: 10.5pt;
        margin-bottom: 3.6mm;
    }

    .heading::after {
        bottom: -1.7mm;
        height: 2px;
        width: 6.5mm;
    }

    .entry + .entry {
        margin-top: 2.8mm;
    }

    .entry-title {
        font-size: 9.4pt;
    }

    .entry-date {
        font-size: 7.4pt;
    }

    .entry-role {
        font-size: 8.3pt;
        margin-top: 0;
    }

    .tags {
        gap: 0.8mm;
        margin-top: 1.1mm;
    }

    .tags li {
        font-size: 6.3pt;
        padding: 0 1.5mm;
    }

    .points {
        margin-top: 1.2mm;
    }

    .points li {
        font-size: 7.9pt;
        line-height: 1.42;
        padding-left: 3mm;
    }

    .points li + li {
        margin-top: 0.5mm;
    }

    .points li::before {
        height: 0.25mm;
        top: 0.72em;
        width: 1.7mm;
    }

    .skill-group + .skill-group {
        margin-top: 2.4mm;
    }

    .skill-label {
        font-size: 6.6pt;
    }

    .skill-text,
    .certs strong {
        font-size: 7.9pt;
    }

    .certs li + li {
        margin-top: 1.8mm;
    }

    .certs span {
        font-size: 7.1pt;
    }

    .sheet-foot {
        font-size: 6.6pt;
        margin-top: 4.5mm;
        padding-top: 2.4mm;
    }

    .entry {
        break-inside: avoid;
    }
}
