:root {
    --primary-color: #BE002E;
    --paper: #FAF6F0;
    --ink: #121212;
    --primary-font: 'Fraunces', serif;
}

@font-face {
    font-family: "Fraunces";
    src: url("../fonts/Fraunces-VariableFont_SOFT,WONK,opsz,wght.ttf") format("truetype");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}



.material-symbols-outlined {
    font-family: "Material Symbols Outlined";
    font-style: normal;
    font-size: .85em;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    font-feature-settings: "liga";
    display: inline-block;
    vertical-align: -.15em;
    margin-inline-start: .25em;
}

#marquee > button > span,
#contact button > span,
#viewer button > span {
    margin-inline-start: 0;
}

body {
    font-family: "Fraunces", Georgia, serif;
    font-variation-settings: "SOFT" 0, "WONK" 0;

    background: var(--paper);
    color: var(--ink);

    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
}

@media (width > 68rem) {
    body::before {
        content: "";
        grid-column: 1;
        grid-row: 1;
        background: var(--primary-color);
    }

    body > header {
        grid-column: 1;
        grid-row: 1;
    }

    main {
        grid-column: 2;
        grid-row: 1;
    }
}

nav > p {
    font-size: .85rem;
}

body > header {
    position: sticky;
    top: 0;
    height: 100vh;
    align-self: start;

    background: var(--primary-color);
    padding: 1.25rem 1.5rem;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}


body > header > button {
    align-self: flex-start;
    margin-left: .5rem;
    padding: 0;
    position: relative;
    isolation: isolate;
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    font-size: 1.1rem;
    cursor: pointer;
}

.jump {
    animation: jump .6s cubic-bezier(.3, .7, .4, 1);
}

@keyframes jump {
    0%   { translate: 0 0;      scale: 1 1; }
    15%  { translate: 0 0;      scale: 1.1 .8; }
    45%  { translate: 0 -1.5rem; scale: .95 1.1; }
    75%  { translate: 0 0;      scale: 1.1 .85; }
    100% { translate: 0 0;      scale: 1 1; }
}

@media (prefers-reduced-motion: reduce) {
    .jump { animation: none; }
}

nav ul {
    font-variation-settings: "SOFT" 0, "WONK" 1;
    list-style: none;
    --base-indent: .8rem;
}

nav ul li {
    font-size: 1.2rem;
    a {
        text-decoration: none;
        position: relative;
        isolation: isolate;
    }
}

/*   halo around nav items -> for separating underline from text   */
nav li a,
body > header > button {
    text-shadow:
        0 .07em 0 var(--primary-color),
        0 -.07em 0 var(--primary-color),
        .07em 0 0 var(--primary-color),
        -.07em 0 0 var(--primary-color),
        .05em .05em 0 var(--primary-color),
        -.05em .05em 0 var(--primary-color),
        .05em -.05em 0 var(--primary-color),
        -.05em -.05em 0 var(--primary-color);
}

nav li a::after,
body > header > button::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: -1;
    width: 100%;
    height: 0.05em;
    background-color: currentColor;
    scale: 0 1;
    transform-origin: right;
    transition: scale 0.3s ease-out;
}

nav li a:hover::after,
nav li a:focus-visible::after,
body > header > button:hover::after,
body > header > button:focus-visible::after {
    scale: 1 1;
    transform-origin: left;
}

nav li:nth-child(1) {
    padding-left: 0;
}

nav li:nth-child(2) {
    padding-left: calc(var(--base-indent) * 1);
}

nav li:nth-child(3) {
    padding-left: calc(var(--base-indent) * 2);
}

nav li:nth-child(4) {
    padding-left: calc(var(--base-indent) * 3);
}

nav li:nth-child(5) {
    padding-left: calc(var(--base-indent) * 4);
}

nav ul:nth-child(n) {
    padding-left: +.5rem;
}

/*
################
    WORK
################
*/
main {
    --main-pad: 3rem;
    padding: 1.5rem var(--main-pad);
}

#marquee {
    position: relative;
    margin: -1.5rem calc(var(--main-pad) * -1) 1.5rem;
    overflow: hidden;
    background: var(--ink);
    color: var(--paper);
    font-size: 1.1rem;
    padding-block: .6rem;
}

#marquee > div {
    display: flex;
    width: max-content;
    animation: marquee var(--marquee-duration, 30s) linear infinite;
}

#marquee:hover > div,
#marquee:focus-within > div,
#marquee:has(button[aria-pressed="true"]) > div {
    animation-play-state: paused;
}

#marquee ul {
    display: flex;
    flex-shrink: 0;
    list-style: none;
}

#marquee li {
    white-space: nowrap;
}

#marquee li::after {
    content: "✦";
    margin-inline: 1.5rem;
    color: var(--primary-color);
}

@keyframes marquee {
    to { translate: -50% 0; }
}

@media (prefers-reduced-motion: reduce) {
    #marquee > div { animation: none; }
    #marquee > button { display: none; }
}

#marquee > button {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    padding-inline: .75rem;
    background: var(--ink);
    color: var(--paper);
    border: 0;
    cursor: pointer;
}

#marquee > button:focus-visible {
    outline: 2px solid var(--paper);
    outline-offset: -4px;
}

#marquee > p {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

main > section + section {
    margin-top: 6rem;
}

#work {
    scroll-margin-top: 5rem;
    min-height: 40rem;
    display: grid;
    grid-template-columns: 1fr minmax(18rem, 26rem);
    gap: 3rem;
    padding-right: 4rem;
    align-items: center;
}

h1 {
    font-size: 4.25rem;
    font-weight: 400;
    font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 1;
    line-height: .8;
    letter-spacing: -0.03em;
}

h1 span {
    display: block;
}

h1 span:first-child {
    color: var(--primary-color);
}

h1 span:last-child {
    padding-left: .6em;
}

/* the section centers its content, so the extra gap under the name is
   mirrored as top padding to keep the h1 where it was */
#work > div {
    padding-top: 1.5rem;
}

#work h1 + p {
    max-width: 24ch;
    margin-top: 4.5rem;
    font-size: 1.5rem;
    line-height: 1.2;
}

#work h1 + p + p {
    margin-top: 1.5rem;
    font-size: 1.25rem;
    font-variation-settings: "SOFT" 0, "WONK" 1;
}

#work ul {
    font-variation-settings: "SOFT" 0, "WONK" 1;
    list-style: none;
    display: flex;
    gap: 1.75rem;
    margin-top: 2rem;
    font-size: 1.25rem;
}

#work h1 + p + p + ul {
    margin-top: 1.25rem;
}

#work ul a,
#work h1 + p + p a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: .2em;
    text-decoration-thickness: 1px;
    transition: color .2s;
}

#work ul a:hover,
#work h1 + p + p a:hover {
    color: var(--primary-color);
}

#work figure {
    position: relative;
    rotate: 2deg;
    transition: rotate .4s cubic-bezier(.3, 1.5, .5, 1);
}

#work figure:hover {
    rotate: 0deg;
}

#rune {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3/4;
    object-fit: cover;
    border: 4px solid var(--ink);
    box-shadow: 14px 14px 0 var(--primary-color);
}

figure button {
    position: absolute;
    left: -2.5rem;
    bottom: 2rem;
    padding: .6rem 1rem;
    background: var(--paper);
    border: 3px solid var(--ink);
    color: var(--primary-color);
    font: inherit;
    font-size: 1.25rem;
    cursor: pointer;
    rotate: -5deg;
    transition: rotate .3s, background .2s, color .2s;
}

figure button:hover {
    rotate: 2deg;
    background: var(--primary-color);
    color: var(--paper);
}

#contact {
    margin: auto;
    padding: 2rem 2.5rem;
    min-width: 18rem;
    background: var(--paper);
    color: var(--ink);
    border: 4px solid var(--ink);
    box-shadow: 12px 12px 0 var(--primary-color);
    rotate: -1.5deg;
    overflow: visible;
}

#contact img {
    position: absolute;
    right: -2.5rem;
    bottom: -2.5rem;
    width: 5.5rem;
    rotate: 14deg;
    cursor: pointer;
}

#contact::backdrop {
    background: rgb(18 18 18 / .55);
}

#contact h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

#contact ul {
    list-style: none;
    display: grid;
    gap: .5rem;
    font-size: 1.5rem;
}

#contact a {
    color: inherit;
    text-underline-offset: .2em;
}

#contact a:hover {
    color: var(--primary-color);
}

#contact button {
    position: absolute;
    top: .5rem;
    right: 1rem;
    background: none;
    border: 0;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
}

/*
###############
    PROJECTS
###############
*/

#projects {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3rem 2.5rem;
    align-items: start;
}

#projects > h2 {
    grid-column: 1 / -1;
}


#projects article {
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 3px solid var(--ink);
    box-shadow: 8px 8px 0 var(--primary-color);
    rotate: -1.5deg;
    transform-origin: 50% calc(1.15rem + 3px);
    transition: rotate .4s cubic-bezier(.3, 1.5, .5, 1);
}

#projects article::before {
    content: "";
    position: absolute;
    top: .6rem;
    left: 50%;
    z-index: 2;
    width: 1.1rem;
    height: 1.1rem;
    translate: -50% 0;
    background: var(--primary-color);
    border: 3px solid var(--ink);
    border-radius: 50%;
    box-shadow: 2px 3px 0 var(--ink);
    pointer-events: none;
}

#projects article:nth-of-type(even) {
    rotate: 1.5deg;
}

#projects article:nth-of-type(3n + 2) {
    margin-top: 3rem;
}

#projects article:hover {
    rotate: 0deg;
}

#projects article > img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-bottom: 3px solid var(--ink);
}

#projects article > :not(img) {
    padding-inline: 1.25rem;
}

#projects h3 {
    margin-top: .75rem;
    font-size: 1.6rem;
    font-weight: 400;
    font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 1;
    line-height: 1.1;
}

#projects h3 a {
    color: inherit;
    text-decoration: none;
}

#projects h3 a::after {
    content: "";
    position: absolute;
    inset: 0;
}

#projects article:has(h3 a:focus-visible) {
    outline: 3px solid var(--ink);
    outline-offset: 6px;
}

#projects article > p {
    margin-top: .4rem;
    font-size: .95rem;
    line-height: 1.3;
}

#projects footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem 1rem;
    margin-top: auto;
    padding-block: 1.25rem;
    font-variation-settings: "SOFT" 0, "WONK" 1;
}

#projects footer a {
    position: relative;
    z-index: 1;
    color: inherit;
    text-underline-offset: .2em;
    transition: color .2s;
}

#projects footer a:hover {
    color: var(--primary-color);
}

#projects footer p {
    font-size: .9rem;
}

@media (max-width: 80rem) {
    #projects {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #projects article:nth-of-type(3n + 2) {
        margin-top: 0;
    }

    #projects article:nth-of-type(even) {
        margin-top: 3rem;
    }
}

@media (min-width: 90rem) {
    #projects {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    #projects article:nth-of-type(3n + 2) {
        margin-top: 0;
    }

    #projects article:nth-of-type(even) {
        margin-top: 3rem;
    }
}

/*
###############
  OFF THE CLOCK
###############
*/

/* a salon hang: one large anchor in the middle, the rest packed around it
   with their inner edges lined up against it */
#off-the-clock > div {
    /* one unit scales the whole cluster down on narrow screens */
    --u: min(1rem, 100cqi / 50);
    container-type: inline-size;
    display: grid;
    grid-template-columns: repeat(3, auto);
    grid-template-areas:
        "left-top    anchor right-top"
        "left-bottom anchor right-bottom"
        ".           bottom .";
    justify-content: center;
    gap: calc(1.25 * var(--u));
    padding: 2rem 0;
}

#off-the-clock figure {
    position: relative;
    width: calc(var(--w) * var(--u));
    aspect-ratio: var(--ratio);
    filter: drop-shadow(0 .5rem .6rem rgb(0 0 0 / .3));
}

#off-the-clock figure::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--frame) center / 100% 100%;
    pointer-events: none;
}

/* the photo sits slightly under the frame, so no gap shows at the edges */
#off-the-clock figure img {
    position: absolute;
    left: calc(var(--x) * 1% - .6%);
    top: calc(var(--y) * 1% - .6%);
    width: calc(var(--ow) * 1% + 1.2%);
    height: calc(var(--oh) * 1% + 1.2%);
    object-fit: cover;
}

#off-the-clock figure[data-frame="gold-ornate"] {
    --frame: url("../img/frames/gold-ornate.webp");
    --ratio: 444 / 297;
    --x: 12.84; --y: 18.18; --ow: 73.65; --oh: 63.64;
}

#off-the-clock figure[data-frame="red-wood"] {
    --frame: url("../img/frames/red-wood.webp");
    --ratio: 421 / 316;
    --x: 9.26; --y: 12.34; --ow: 81.47; --oh: 75.32;
}

#off-the-clock figure[data-frame="dark-wood"] {
    --frame: url("../img/frames/dark-wood.webp");
    --ratio: 640 / 841;
    --x: 10.62; --y: 8.09; --ow: 78.75; --oh: 83.73;
}

#off-the-clock figure[data-frame="light-wood"] {
    --frame: url("../img/frames/light-wood.webp");
    --ratio: 247 / 330;
    --x: 13.36; --y: 9.7; --ow: 73.68; --oh: 80.61;
}

#off-the-clock figure[data-frame="baroque"] {
    --frame: url("../img/frames/baroque.webp");
    --ratio: 640 / 721;
    --x: 16.35; --y: 14.57; --ow: 65.68; --oh: 71.36;
}

/* placement, size and a slight hand-hung tilt per spot */
#off-the-clock figure:nth-child(1) { grid-area: anchor; --w: 20; align-self: end; rotate: -.4deg; }
#off-the-clock figure:nth-child(2) { grid-area: left-top; --w: 10; align-self: end; justify-self: end; rotate: .8deg; }
#off-the-clock figure:nth-child(3) { grid-area: left-bottom; --w: 12; align-self: start; justify-self: end; rotate: -1deg; }
#off-the-clock figure:nth-child(4) { grid-area: right-top; --w: 13; align-self: end; justify-self: start; rotate: .6deg; translate: 0 calc(-1.5 * var(--u)); }
#off-the-clock figure:nth-child(5) { grid-area: right-bottom; --w: 10; align-self: start; justify-self: start; translate: calc(1.5 * var(--u)) 0; rotate: -.7deg; }
#off-the-clock figure:nth-child(6) { grid-area: bottom; --w: 11; justify-self: start; translate: calc(3 * var(--u)) 0; rotate: 1.1deg; }

/*
###############
      BLOG
###############
*/

#blog {
    display: grid;
    gap: 2.75rem;
    max-width: 52rem;
    padding-bottom: 6rem;
}

#blog article {
    position: relative;
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    column-gap: 1.75rem;
}

#blog article > img {
    grid-row: 1 / -1;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 3px solid var(--ink);
    box-shadow: 6px 6px 0 var(--primary-color);
}

#blog article > p:first-of-type {
    margin-top: .2rem;
    color: var(--primary-color);
    font-size: .9rem;
}

#blog h3 {
    margin-top: .2rem;
    font-size: 1.6rem;
    font-weight: 400;
    font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 1;
    line-height: 1.1;
}

#blog h3 a {
    color: inherit;
    text-decoration: none;
    transition: color .2s;
}

#blog h3 a::after {
    content: "";
    position: absolute;
    inset: 0;
}

#blog h3 a:hover,
#blog h3 a:focus-visible {
    color: var(--primary-color);
}

#blog article > p:last-child {
    margin-top: .5rem;
    font-size: .95rem;
    line-height: 1.35;
}

@media (max-width: 40rem) {
    #blog article {
        grid-template-columns: 1fr;
    }

    #blog article > img {
        grid-row: auto;
        margin-bottom: 1rem;
    }
}

main > article {
    --rule: color-mix(in srgb, var(--ink) 22%, transparent);
    display: grid;
    gap: 1.25rem;
    max-width: 44rem;
    padding-bottom: 6rem;
    line-height: 1.5;
}

main > article > header {
    display: grid;
    gap: 1.25rem;
    align-content: start;
}

main > article > header > img {
    width: 100%;
    height: auto;
    max-width: 36rem;
    margin-bottom: 1rem;
    border: 3px solid var(--ink);
    box-shadow: 8px 8px 0 var(--primary-color);
}

/* the same image with a credit underneath */
main > article > header > figure {
    display: grid;
    gap: 1rem;
    align-content: start;
    max-width: 36rem;
    margin-bottom: 1rem;
}

main > article > header > figure > img {
    width: 100%;
    height: auto;
    border: 3px solid var(--ink);
    box-shadow: 8px 8px 0 var(--primary-color);
}

main > article > img {
    width: 100%;
    height: auto;
    border: 3px solid var(--ink);
    box-shadow: 8px 8px 0 var(--primary-color);
}

main > article > header > h1 {
    padding-bottom: .2em;
    font-size: clamp(4rem, 8vw, 6.5rem);
}

main > article > header > p {
    max-width: 38rem;
    font-size: 1.3rem;
    line-height: 1.4;
}

main > article > section {
    display: grid;
    gap: 1.5rem;
    margin-top: 2.5rem;
}

main > article h2 {
    font-size: 2.25rem;
    font-weight: 400;
    font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 1;
    line-height: 1;
}

main > article > section > ul {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    list-style: none;
}

main > article > section > ul > li {
    padding: .1rem .6rem;
    border: 1px solid var(--ink);
    font-size: .9rem;
}

main > article > section > ul > li.pattern {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

main > article dl {
    display: grid;
    grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr);
}

main > article dt,
main > article dd {
    margin: 0;
    padding-block: .8rem;
    border-top: 1px solid var(--rule);
}

main > article dt:first-of-type,
main > article dt:first-of-type + dd {
    border-top: 0;
    padding-top: 0;
}

main > article dt {
    padding-right: 1.5rem;
    font-weight: 600;
    font-variation-settings: "SOFT" 0, "WONK" 1;
}

main > article section section {
    display: grid;
    gap: .3rem;
    margin-top: .75rem;
}

main > article h3 {
    font-size: 1.4rem;
    font-weight: 400;
    font-variation-settings: "opsz" 72, "SOFT" 0, "WONK" 1;
    line-height: 1.15;
}

main > article h3 + p {
    font-size: .95rem;
    font-variation-settings: "SOFT" 0, "WONK" 1;
}

main > article section section ul {
    display: grid;
    gap: .3rem;
    margin-top: .3rem;
    padding-left: 1.25rem;
}

main > article section section li::marker {
    color: var(--primary-color);
}

main > article > header > ul {
    display: grid;
    gap: .4rem;
    max-width: 38rem;
    padding-left: 1.25rem;
}

main > article > header > ul > li::marker {
    color: var(--primary-color);
}

main > article > header > footer,
main > article > header > figure > figcaption {
    display: grid;
    gap: .5rem;
}

main > article > header > footer p,
main > article > header > figure > figcaption p {
    font-size: .95rem;
}

main > article > header > footer ul,
main > article > header > figure > figcaption ul {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    list-style: none;
}

/* beside an image the label and chip share one line */
main > article > header > figure > figcaption {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
}

main > article > header > footer li,
main > article > header > figure > figcaption li {
    border: 1px solid var(--primary-color);
}

main > article > header > footer li > a[href],
main > article > header > figure > figcaption li > a[href] {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .1rem .6rem;
    color: var(--primary-color);
    font-size: .9rem;
    text-decoration: none;
    transition: background-color .2s, color .2s;
}

main > article > header > footer li > a[href]:hover,
main > article > header > figure > figcaption li > a[href]:hover {
    background: var(--primary-color);
    color: var(--paper);
}

main > article > header > footer li > a[href]::before,
main > article > header > figure > figcaption li > a[href]::before {
    content: "";
    width: 1em;
    height: 1em;
    background-color: currentColor;
    mask: url("../img/linkedin.svg") center / contain no-repeat;
}

main > article > header > footer li > a[href*="github.com"]::before,
main > article > header > figure > figcaption li > a[href*="github.com"]::before {
    mask-image: url("../img/github.svg");
}

main > article > header > ul strong {
    display: block;
    font-weight: 600;
}

main > article > header > div {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.75rem;
}

main > article > header > div > a {
    justify-self: start;
    color: inherit;
    font-size: 1.15rem;
    text-underline-offset: .2em;
}

main > article > header > div > a:hover {
    color: var(--primary-color);
}

/* blog posts: same article layout as project pages, with a date and running text */
main > article > header > time {
    color: var(--primary-color);
    font-size: 1rem;
}

main > article:has(> header > time) > header > h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    line-height: 1.05;
}

main > article > p,
main > article > section > p {
    max-width: 38rem;
    font-size: 1.1rem;
}

main > article > ul {
    display: grid;
    gap: .3rem;
    max-width: 38rem;
    padding-left: 1.25rem;
    font-size: 1.1rem;
}

main > article > ul > li::marker {
    color: var(--primary-color);
}

main > article > h2 {
    margin-top: 2rem;
}

main > article > figure {
    display: grid;
    gap: .75rem;
    max-width: 44rem;
    margin-block: 1rem;
}

main > article > figure > img {
    width: auto;
    max-width: 100%;
    max-height: 36rem;
    height: auto;
    border: 3px solid var(--ink);
    box-shadow: 8px 8px 0 var(--primary-color);
}

/* two photos side by side */
main > article > figure:has(> img + img) {
    grid-template-columns: 1fr 1fr;
}

main > article > figure:has(> img + img) > img {
    width: 100%;
    max-height: none;
}

main > article > figure:has(> img + img) > figcaption {
    grid-column: 1 / -1;
}

main > article > figure > figcaption {
    font-size: .9rem;
    color: color-mix(in srgb, var(--ink) 70%, transparent);
}

main > article > iframe {
    width: 100%;
    max-width: 504px;
    height: 36rem;
    margin-block: 1rem;
    background: white;
    border: 3px solid var(--ink);
    box-shadow: 8px 8px 0 var(--primary-color);
}

/* experience: each role is a card, like the project cards */
#experience > section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: .35rem 1rem;
    max-width: 44rem;
    margin-top: .5rem;
    padding: 1.25rem 1.5rem;
    background: var(--paper);
    border: 3px solid var(--ink);
    box-shadow: 8px 8px 0 var(--primary-color);
}

#experience small {
    padding: .1rem .6rem;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    font-size: .9rem;
    white-space: nowrap;
}

#experience p {
    grid-column: 1 / -1;
    font-size: 1rem;
    font-weight: 600;
    font-variation-settings: "SOFT" 0, "WONK" 1;
}

#experience ul {
    grid-column: 1 / -1;
    margin-top: .6rem;
}

#gallery > div {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: .75rem;
}

#gallery a {
    display: block;
    border: 2px solid var(--ink);
    transition: border-color .2s;
}

#gallery a:hover,
#gallery a:focus-visible {
    border-color: var(--primary-color);
}

#gallery img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    object-position: top;
}

#viewer {
    margin: auto;
    padding: 3.75rem 1rem 1rem;
    width: min(92vw, 72rem, calc((92vh - 9rem) * var(--ratio, 1.6) + 2rem + 6px));
    max-width: none;
    background: var(--paper);
    color: var(--ink);
    border: 3px solid var(--primary-color);
}

#viewer::backdrop {
    background: rgb(18 18 18 / .75);
}

#viewer img {
    display: block;
    width: 100%;
    aspect-ratio: var(--ratio, 1.6);
    object-fit: contain;
}

#viewer > [data-close] {
    position: absolute;
    top: .5rem;
    right: .5rem;
}

#viewer footer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .75rem;
    margin-top: .75rem;
}

#viewer footer p {
    min-height: 2.8em;
    line-height: 1.4;
    text-align: center;
}

#viewer button {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    background: none;
    border: 2px solid var(--ink);
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
}

#viewer button:hover,
#viewer button:focus-visible {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

@media (min-width: 57rem) {
    main > article {
        max-width: 76rem;
    }

    main > article > header {
        container-type: inline-size;
        grid-template-columns: minmax(0, 1.2fr) minmax(16rem, 1fr);
        grid-template-rows: 1fr auto auto auto auto auto 1fr;
        column-gap: 3rem;
        padding-top: 2rem;
    }

    main > article > header > h1 {
        font-size: clamp(3.5rem, 9cqi, 6.5rem);
    }

    main > article > header > img,
    main > article > header > figure {
        grid-column: 2;
        grid-row: 1 / -1;
        margin-bottom: 0;
    }

    main > article > header > figure {
        align-self: start;
    }

    main > article > header > :not(img, figure) {
        grid-column: 1;
        align-self: start;
    }

    main > article > header > h1 {
        grid-row: 2;
    }

    main > article > header > time {
        grid-row: 1;
        align-self: end;
    }

    main > article > header > p {
        grid-row: 3;
    }

    main > article > header > ul {
        grid-row: 4;
    }

    main > article > header > div {
        grid-row: 5;
    }

    main > article > header > footer {
        grid-row: 6;
    }

    main > article > section {
        max-width: 44rem;
    }
}

@media (max-width: 56rem) {
    main > article {
        padding-bottom: 4rem;
    }

    #gallery > div {
        grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
        gap: .5rem;
    }

    #viewer footer p {
        min-height: 4.2em;
    }

    main > article > header {
        gap: 1rem;
    }

    main > article > header > img,
    main > article > header > figure {
        margin-bottom: .5rem;
    }

    main > article > header > h1 {
        font-size: 3.5rem;
    }

    main > article > header > p {
        font-size: 1.1rem;
        line-height: 1.45;
    }

    main > article > section {
        margin-top: 2rem;
    }
}

@media (max-width: 40rem) {
    main > article dl {
        grid-template-columns: minmax(0, 1fr);
    }

    main > article dd {
        border-top: 0;
        padding-top: 0;
    }

    main > article dt:first-of-type + dd {
        padding-top: 0;
    }

    #projects {
        gap: 2rem 1rem;
    }

    #projects article {
        padding-bottom: .75rem;
        box-shadow: 5px 5px 0 var(--primary-color);
    }

    #projects article:nth-of-type(even) {
        margin-top: 1.5rem;
    }

    #projects article > :not(img) {
        padding-inline: .75rem;
    }

    #projects h3 {
        margin-top: .6rem;
        font-size: 1.15rem;
    }

    #projects article > p {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        overflow: hidden;
        font-size: .85rem;
        line-height: 1.3;
    }

    #projects footer {
        padding-block: .5rem 0;
        font-size: .85rem;
    }

    #projects footer a {
        white-space: nowrap;
    }

    #projects footer p {
        display: none;
    }

    #projects footer:not(:has(a)) {
        display: none;
    }
}

h2 {
    font-size: 3rem;
    font-weight: 400;
    font-variation-settings: "opsz" 144;
}

/* name and intro grow with the available width, in steps */
@media (min-width: 40rem) {
    h1 {
        font-size: 5.5rem;
    }
}

@media (min-width: 80rem) {
    h1 {
        font-size: 7.5rem;
    }

    #work h1 + p {
        font-size: 2rem;
    }
}

@media (min-width: 96rem) {
    h1 {
        font-size: 10rem;
    }
}

@media (max-width: 68rem) {
    html {
        scroll-padding-top: 3.5rem;
    }

    body {
        grid-template-columns: minmax(0, 1fr);
    }

    body > header {
        height: auto;
        padding: .75rem 1.5rem;
        z-index: 1;
    }

    body > header > button,
    nav > p {
        display: none;
    }

    nav ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0 1rem;
        padding-left: 0;
    }

    nav ul li {
        padding-left: 0 !important;
        font-size: 1.1rem;
    }

    main {
        --main-pad: 1.5rem;
    }

    #work {
        grid-template-columns: 1fr;
        min-height: 0;
        padding-right: 0;
    }

    #work figure {
        max-width: 18rem;
        margin: 1rem 0 0 1rem;
    }

    figure button {
        left: -1rem;
    }
}
