:root
{
    --bg: #f0ede6;
    --text: #171717;
    --hover: #070707;
    --muted: #575757;
    --faded: #979797;
    --primary: #00b0cd;
    --secondary: #80c0cc;

    --yellow: #ECAF21;
    --yellow-body: #E29900;
    --red: #eb452b;
    --red-body: #de342a;
    --blue: #0070C0;
    --black: #272727;
    --green: #03A653;

    --line: #272727;
    --light: #dfdfdf;
    --white: #f7f7f7;
    --surface: rgba(255, 255, 255, 0.28);

    --font-sans: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;

    --column-width: min(72rem, calc(100% - 3rem));
    --content-width: min(44rem, calc(100% - 3rem));
    --header-height: 4rem;
    --hero-min: 800px;
    --article-grid: 1fr;
    --article-gap: 2rem;
    --article-top: 0;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    background: var(--bg);
}

a {
    color: inherit;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-thickness: 0.1rem;
    text-underline-offset: 0.2rem;

    &:hover {
        color: var(--hover);
        text-decoration: underline;
        text-decoration-thickness: 2.5px;
        text-underline-offset: 0.2rem;
    }

    &[in] {
        text-decoration-style: dotted;
    }
}

h1 {
    font-size: clamp(2.75rem, 9dvw, 4rem);
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1.05;
    margin: 0 0 1rem;
}

h2 {
    font-size: clamp(1.75rem, 2.5dvw, 2.375rem);
    font-weight: 800;
    line-height: 1.1;
    margin: 0 0 1.5rem;
    padding-top: 2rem;
    text-shadow: 0 1px 0 #fff;
}

h3 {
    color: var(--text);
    font-size: clamp(1.33rem, 1.75dvw, 1.625rem);
    font-weight: 800;
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 1rem;
    text-shadow: 0 1px 0 #fff;

    #impact & {
        font-size: 1.2rem;
    }
}

h4 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 0;
    text-shadow: 0 1px 0 #fff;
}

code {
    font-size: 0.875rem;
    background: var(--light);
    border-radius: 3px;
    padding: 0.125rem 0.25rem;
}

body {
    margin: 0 auto;
    padding: 0;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    display: grid;
    font-family: var(--font-sans);
    grid-template-rows: var(--header-height) 1fr auto;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    width: 100dvw;

    /* site header and footer defaults */
    > header,
    > footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }

    /* site header */
    > header {
        border-bottom: 1px solid var(--black);
        padding: 0 1.5rem;
        position: relative;

        .title {
            align-items: center;
            display: flex;
            gap: 0.75rem;
            height: 100%;
            align-items: stretch;
        }

        .logo,
        .page {
            align-items: center;
            display: flex;
            font-size: 1.5rem;
            gap: 0.5rem;
            text-decoration: none;

            &:hover {
                text-decoration: underline;
            }
        }

        .logo {
            font-weight: 700;
            letter-spacing: -0.04rem
        }

        .page {
            font-weight: 800;
        }

        .logo:has(+ .page) {
            font-weight: 500;
            letter-spacing: 0;
        }

        /* right menu */
        menu {
            align-items: center;
            display: flex;
            gap: 1rem;
            font-size: 1rem;
            list-style: none;
            padding: 0;

            a {
                align-items: center;
                display: flex;
                justify-content: center;
            }

            span {
                display: none;
            }

            .icon {
                height: 1.5rem;
                width: 1.5rem;

                &.icon-mail {
                    position: relative;
                    top: -1px;
                }
            }

            a:hover {
                color: #000;
                text-decoration-thickness: 2.5px;
            }
        }

        /* line detail */
        &::before,
        &::after {
            content: '';
            display: block;
            width: calc(100% + 1.5rem);
            height: 1px;
            background: var(--black);
            position: absolute;
            bottom: -5px;
            left: -1.5rem;
        }
        &::after {
            bottom: -9px;
        }
    }

    /* site footer */
    > footer {
        background: var(--black);
        color: var(--white);
        display: flex;
        flex-direction: column;
        font-size: 0.95rem;
        line-height: 1.5;
        padding: 2rem 1.5rem;
        justify-content: center;

        section {
            display: grid;
            justify-content: left;
            width: 100%;
        }

        big {
            color: var(--white);
            font-size: 1.5rem;
            font-weight: bold;
            margin-bottom: 1rem;

            span {
                color: var(--faded);
                font-weight: 400;
                padding-left: 0.25rem;
            }
        }

        a:hover {
            color: var(--light);
        }

        code {
            background: var(--hover);
        }

        #end
        {
            .text p:first-child {
                margin-top: 0.65rem;
            }

            .icon {
                margin-right: 0.25rem;
                position: relative;
                top: 3px;
            }
        }

        #footnotes
        {
            ul {
                list-style: none;
                padding: 0;
            }

            li {
                display: grid;
                grid-template-columns: 1.5rem auto;
                margin-bottom: 1rem;

                span.symbol {
                    font-size: 1.25rem;
                    margin-top: -3px;
                }
            }

            big {
                order: 1;
                padding-top: 2rem;
            }

            a.return {
                margin-left: 0.25rem;
            }
        }

        menu {
            display: flex;
            flex-direction: row;
            gap: 1rem;
            list-style: none;
            padding-left: 0;
        }
    }
}

/*
 * <main> is case study wrapper and includes:
 *   1. <header> is the initial full screen pane
 *   2. <nav> is for the TOC
 *   3. <article> holds the actual case study
 */
main {
    display: grid;
    grid-template-columns: auto;
    grid-template-rows: min-content auto; /* header is full initial pane, then content is auto */
    justify-items: center;

    /* layout handling for the top sections */
    > header {
        align-content: start;
        display: grid;
        grid-auto-rows: auto auto; /* @todo make row 2 12rem on larger screens */
        justify-items: center;
        max-width: 100lvw;
        padding-bottom: 10rem; /* artwork pad on mobile */
        width: 100lvw;

        hgroup,
        aside {
            display: flex;
            width: var(--column-width);
        }

        /* top hero */
        hgroup {
            align-content: end;
            display: grid;
            margin-top: 3rem;
            padding: 0;

            .lede {
                margin: 1rem 0 0;
                font-size: 1.4rem;
                font-weight: 400;
                line-height: 1.5;

                strong {
                    font-weight: 700;
                }

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

                a {
                    text-decoration-thickness: 0.15rem;

                    &:hover {
                        text-decoration-thickness: 0.2rem;
                    }
                }
            }
        }

        /* stats */
        aside {
            align-items: flex-start;
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
            justify-content: flex-start;
            margin-bottom: 2rem;
            margin-top: 2rem;

            figure {
                display: grid;
                grid-template-columns: 2.25rem auto;
                grid-template-rows: 1.5rem auto;
                margin: 0;
                --icon: var(--yellow);

                span.icon {
                    width: 1.5rem;
                    height: 1.5rem;
                    color: var(--icon);
                }

                label {
                    color: var(--text);
                    font-size: .95rem;
                    text-transform: uppercase;
                    font-weight: 600;
                }

                figcaption {
                    color: var(--muted);
                    font-size: 1rem;
                    line-height: 1.4;
                    grid-column-start: 2;

                    span {
                        display: inline;
                    }
                }

                &:nth-child(2) {
                    --icon: var(--black);
                }
                &:nth-child(3) {
                    --icon: var(--red);
                }
                &:nth-child(4) {
                    --icon: var(--green);
                }
                &:nth-child(5) {
                    --icon: var(--blue);
                }
            }
        }
    }

    /* case study content */
    > article {
        background: var(--white);
        border-top: 0.5rem solid var(--black);
        display: grid;
        gap: var(--article-gap);
        grid-template-columns: var(--article-grid);
        justify-content: center;
        padding: var(--article-top) 1.5rem 3rem;
        width: 100%;

        #content {
            display: grid;
            gap: 0;

            ul {
                li {
                    margin-bottom: 1rem;
                }
            }
        }

        p {
            font-size: 1.1rem;
        }

        a.fn {
            text-decoration: none;

            &.sect {
                font-size: 0.7rem;
                vertical-align: super;
            }
        }

        section {
            width: 100%;

            &#intro
            {
                h2 {
                    padding-top: 0;
                }

                p:first-of-type {
                    font-size: 1.25rem;
                }
            }
        }

        figure {
            /*background: var(--bg);*/
            align-items: center;
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
            justify-content: center;
            margin: 2rem 0;
            padding: 0;
            position: relative;

            img {
                max-width: 100%;

                &.desktop {
                    aspect-ratio: 1.4 / 1;
                }
                &.mobile {
                    aspect-ratio: 0.46 / 1;
                    height: 20rem;
                }
            }

            figcaption {
                color: var(--muted);
                font-size: 0.875rem;
                line-height: 1.5;
                font-style: italic;
                padding-left: 0.125rem;

                p {
                    margin: 0;
                }
            }

            &.rounded {
                img {
                    border-radius: 0.5rem;
                }
            }
            &.rounded-tl {
                img {
                    border-radius: 0.5rem 0 0;
                }
            }
        }
    }
}

/* table of contents */
nav {
    align-self: start;
    position: sticky;
    margin-left: -1.5rem;
    top: 0;
    width: calc(100% + 3rem);
    overflow-x: hidden;
    z-index: 2;

    ol {
        backdrop-filter: blur(0.5rem);
        background: rgba(247, 247, 247, 0.8);
        display: flex;
        flex-direction: row;
        list-style: decimal-leading-zero;
        list-style-position: inside;
        margin: 0;
        overflow-x: auto;
        padding: 0;
    }

    li {
        border-bottom: 1px solid var(--black);
        height: 3rem;
        padding: 0.7rem 1.5rem 0.5rem;
        position: relative;
        white-space: nowrap;

        &::marker {
            color: var(--muted);
        }

        &.active
        {
            &::after {
                background: var(--black);
                bottom: 0;
                content: '';
                display: block;
                height: 4px;
                left: 1.5rem;
                position: absolute;
                width: calc(100% - 3rem);
            }

            a {
                color: var(--text);
                font-weight: 700;
            }
        }

        &.group {
            display: flex;
            flex-direction: row;
            padding: 0;

            a {
                display: inline-block;
                padding: 0.7rem 0 0.5rem;
            }

            /* direct child link needs manual marker */
            > a {
                padding: 0.7rem 1.5rem 0.5rem 3rem;

                &::before {
                    color: var(--muted);
                    content: attr(data-id);
                    font-weight: 400;
                    left: 1.25rem;
                    position: absolute;
                    text-align: right;
                    width: 1.5rem;
                }
            }
        }
    }

    /* sub lists */
    ul {
        display: flex;
        flex-direction: row;
        list-style: disc;
        list-style-position: inside;
        margin: 0;
        padding: 0;

        li {
            padding: 0 1.5rem;
        }
    }

    /* links and text */
    a,
    span {
        color: var(--muted);
        text-decoration: none;
        transition: padding 125ms ease;
    }

    a {
        &:hover {
            color: var(--text);
            text-decoration-thickness: 1.5px;
        }
    }
}

/**
 * case study elements
 */

.icon {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    height: 1rem;
    justify-content: center;
    line-height: 1;
    width: 1rem;
}

.icon svg {
    display: block;
    height: 100%;
    width: 100%;
}

.problem
{
    &:first-of-type mark {
        --mark-color: var(--yellow-body);
    }
    &:nth-of-type(2) mark {
        --mark-color: var(--red-body);
    }
    &:nth-of-type(3) mark {
        --mark-color: var(--green);
    }
}

.responses {
    display: flex;
    flex-direction: column;

    .response {

        h3:first-of-type {
            margin-top: 1rem;
        }

        .lede {
            margin-bottom: 1rem;
        }

        h4 + p {
        }
    }
}

.response-body {
    p:first-child {
        margin-top: 0;
    }
}

details:not(.hc-dropdown) {
    border-top: 1px solid var(--light);

    &:first-of-type {
        border-top-width: 3px;
        margin-top: 2rem;
    }
    &:last-of-type {
        border-bottom: 1px solid var(--light);
        margin-bottom: 1.5rem;
    }

    summary {
        align-items: center;
        color: var(--muted);
        cursor: pointer;
        display: flex;
        font-weight: 700;
        font-size: 1.1rem;
        line-height: 1.3;
        min-height: 3rem;
        padding: 0.625rem 0 0.625rem 2px;
        position: relative;
        text-decoration-color: transparent;
        transition: padding 125ms ease, color 125ms ease, text-decoration 150ms ease;

        &:hover {
            text-decoration: underline;
            text-decoration-color: currentColor;
            text-decoration-thickness: 1.5px;
            text-underline-offset: 0.2rem;
        }

        &::before {
            content: "→";
            display: block;
            font-size: 1.5rem;
            font-weight: normal;
            left: -2rem;
            opacity: 0;
            position: absolute;
            top: 0.5rem;
            visibility: invisible;
            transition: opacity 250ms ease, visibility 250ms ease, left 250ms ease;
        }
    }

    div {
        padding-left: 2px;

        p:first-child {
            margin-top: 0.25rem;
        }
    }

    &[open] summary,
    summary:hover {
        color: var(--text);
        padding-left: 0.5rem;
    }

    &[open] summary::before {
        left: -1.25rem;
        opacity: 100;
        visibility: visible;
    }
}

mark {
    --mark-color: var(--blue);
    color: var(--mark-color);
    font-weight: 900 !important;
    background-color: transparent;
    background-image: repeating-linear-gradient(
        to bottom,
        var(--muted) 0 1px,
        transparent 1px 3px
    );
    background-repeat: no-repeat;
    background-size: 100% 9px;
    background-position: left bottom;
    padding-bottom: 0.25rem;

    &[color="yellow"] {
        --mark-color: var(--yellow-body);
    }

    &[color="red"] {
        --mark-color: var(--red-body);
    }

    &[color="green"] {
        --mark-color: var(--green);
    }

    p & {
        padding-bottom: clamp(7px, 0.33rem, 9px);
    }

    h3 & {
        font-weight: 700;
        --mark-height: 0.72em;
        --mark-overlap: 0.2rem;
    }
}

span[color="blue"] {
    color: var(--blue);
}
span[color="red"] {
    color: var(--red-body);
}
span[color="yellow"] {
    color: var(--yellow-body);
}
span[color="green"] {
    color: var(--green);
}


/**
 * specific page handling
 */

/* homepage */
body#default
{
    main > header {
        overflow-x: hidden;
        position: relative;

        /* css shapes art */
        #circle,
        #rectangle,
        #semicircle,
        #square,
        #triangle {
            position: absolute;
            transition: transform 2000ms ease-in-out;
        }
        #semicircle {
            background: var(--green);
            bottom: 12dvw;
            height: 10dvw;
            border-radius: 10dvw 10dvw 0 0;
            left: 60dvw;
            width: 20dvw;
        }
        #square {
            background: var(--black);
            height: 12dvw;
            width: 12dvw;
            bottom: 0;
            left: 54dvw;
        }
        #circle {
            background: var(--blue);
            border-radius: 50%;
            height: 16dvw;
            bottom: 3dvh;
            left: 4dvw;
            width: 16dvw;

            &:hover {
                transform: translateX(1rem);
            }
        }
        #rectangle {
            background: var(--yellow);
            height: 3dvh;
            width: 32dvw;
            left: 2dvw;
            bottom: 0;
            transform-origin: 38%;
        }
        #triangle {
            background: var(--red);
            height: 32dvw;
            width: 32dvw;
            bottom: 0;
            right: 0;
            clip-path: polygon(100% 0, 100% 100%, 0 100%);
        }
    }

    > footer {
        background: var(--bg);
        color: var(--text);

        big {
            color: var(--text);
        }

        a:hover {
            color: var(--hover);
        }
    }
}

/* list content */
section#studies {
    background: var(--black);
    display: grid;
    gap: 3rem;
    justify-items: center;
    padding: 5rem 0;

    h1 {
        border-bottom: 0.25rem solid var(--white);
        color: #fff;
        margin-bottom: 0;
        max-width: var(--column-width);
        padding-bottom: 1rem;
        width: var(--column-width);
    }

    > div {
        color: var(--white);
        padding-right: 1rem;
        margin-bottom: 0;
        max-width: var(--column-width);

        p:first-child {
            margin-top: -1rem;
        }

        a:hover,
        a:active {
            color: #fff;
            text-decoration-thickness: 0.15rem;
        }
    }

    /* main card element */
    article {
        background-color: var(--card-color);
        background-image: var(--card-bg);
        background-repeat: no-repeat;
        border-top: 2px solid var(--hover);
        border-bottom: 0.5rem solid var(--hover);
        transition: filter 200ms ease-in-out;
        --card-color: var(--blue);

        > a {
            color: inherit;
            display: block;
            height: 100%;
            padding: 2rem 1.5rem 2.5rem;
            text-decoration: none;
            width: 100%;
        }

        h2 {
            font-size: 2rem;
            font-weight: 700;
            display: inline-flex;
            padding-top: 0;
            position: relative;
            text-shadow: none;

            &::after {
                content: "→";
                display: block;
                opacity: 0;
                position: relative;
                right: -0.5rem;
                top: 2px;
                transition: right 200ms ease-in-out, visibility 200ms ease-in-out, opacity 200ms ease-in-out;
                visibility: invisible;
            }
        }

        p:first-of-type {
            font-size: 1.35rem;
            font-weight: 500;
            line-height: 1.4;
            margin: 0 0 0.5rem;
            text-shadow: none;

            + p {
                display: none;
            }
        }

        div {
            display: flex;
            flex-direction: column;
            gap: 1rem;
            padding-top: 1rem;

            > figure {
                margin: 0;
                max-width: 50%;

                .icon {
                    color: var(--icon-color);
                    width: 1.25rem;
                    height: 1.25rem;
                }

                figcaption {
                    font-size: 0.875rem;
                    font-weight: 700;
                    text-transform: uppercase;
                }
            }
        }

        &:hover
        {
            h2::after {
                opacity: 100;
                right: -1rem;
                visibility: visible;
            }
        }

        /* specific studies */
        &#honeycomb {
            background-position: bottom -13rem right -4rem;
            background-size: auto 30rem;
        }
        &#legacy {
            background-position: bottom -16rem right -1rem;
            background-size: auto 30rem;
        }

        &[color="blue"] {
            color: var(--white);

            &:hover {
                filter: brightness(95%);
            }

            div > figure .icon {
                color: color-mix(in srgb, var(--icon-color), #fff 50%);
            }
        }

        &[color="yellow"] {
            --card-color: var(--yellow);
            color: var(--black);

            &:hover {
                filter: brightness(105%);
            }
        }

        /* inset the article when clicking the link */
        &:has(a:active) {
            border-bottom-width: 2px;
            margin: calc(0.5rem - 2px) 0 0;
        }
    }
}

/* legacy case study */
body#legacy
{
    main > header {
        background-image: url('/img/nyc.svg');
        background-position: bottom 0 right -20dvw;
        background-repeat: no-repeat;
        background-size: clamp(300px, 50dvw, 800px) auto;
        position: relative;

        > svg {
            bottom: -1px;
            height: auto;
            left: -5dvw;
            width: clamp(150px, 20dvw, 320px);
            position: absolute;
        }
    }
}

/* honeycomb case study */
body#honeycomb
{
    main > header {
        overflow: hidden;
        padding-bottom: 4rem;
        --inspector-line: rgba(163, 88, 242, 1);
        --angled-line: rgba(163, 88, 242, 0.33);

        /* inspector lines are the same on all screen sizes */
        hgroup {
            position: relative;

            &::before,
            &::after {
                background: linear-gradient(to bottom, var(--inspector-line) 0 50%, transparent 50% 100%);
                background-repeat: repeat-y;
                background-size: 1px 0.5rem;
                content: '';
                display: block;
                height: 150lvh;
                position: absolute;
                top: -25lvh;
                width: 1px;
            }
            &::before {
                left: 0;
            }
            &::after {
                right: 0;
            }

            > h1,
            > p {
                position: relative;
            }
        }

        aside {
            margin-bottom: 8dvh;
            position: relative;
        }

        hgroup > h1::before,
        hgroup > p::after,
        aside::before,
        aside::after {
            background: linear-gradient(to right, var(--inspector-line) 0 50%, transparent 50% 100%);
            background-repeat: repeat-x;
            background-size: 0.5rem 1px;
            content: '';
            display: block;
            height: 1px;
            left: -25dvw;
            position: absolute;
            width: 150dvw;
        }
        hgroup > h1::before,
        aside::before {
            top: 0;
        }
        hgroup > h1::after,
        aside::after {
            bottom: 0;
        }

        /* shapes grid */
        #grid {
            height: var(--shape-size);
            max-width: 100dvw;
            position: relative;
            width: 100dvw;
            display: grid;
            grid-template-columns: 1fr var(--column-width) 1fr;
            grid-template-rows: 1px 1fr 1px;
            --shape-size: min(6dvh, 3rem);

            &::before,
            &::after {
                background: linear-gradient(to right, var(--inspector-line) 0 50%, transparent 50% 100%);
                background-repeat: repeat-x;
                background-size: 0.5rem 1px;
                content: '';
                display: block;
                grid-column: 1 / 4;
                height: 1px;
            }

            #shapes {
                display: grid;
                gap: 1.5rem;
                grid-column: 2 / 4;
                grid-template-columns: 1fr 1fr 1fr 1fr;
                width: calc(100% - 1.5rem);
            }

            #square {
                height: var(--shape-size);
                max-height: var(--shape-size);
                max-width: var(--shape-size);
                width: var(--shape-size);
                background-color: var(--blue);
            }

            #circle {
                background-color: var(--red);
                border-radius: 50%;
                height: var(--shape-size);
                max-height: var(--shape-size);
                max-width: var(--shape-size);
                position: relative;
                width: var(--shape-size);
            }

            #triangle {
                aspect-ratio: 1/cos(30deg);
                background-color: var(--green);
                clip-path: polygon(50% 0,100% 100%,0 100%);
                height: var(--shape-size);
                max-height: var(--shape-size);
                position: relative;
            }

            #rectangle {
                background-color: var(--yellow);
                height: var(--shape-size);
                max-height: var(--shape-size);
                position: relative;
            }

            #circle::before,
            #rectangle::before,
            #rectangle::after {
                background-image:
                    repeating-linear-gradient(
                      to bottom,
                      var(--inspector-line) 0 1px,
                      transparent 0.25rem 0.5rem
                    ),
                    repeating-linear-gradient(
                      to bottom,
                      var(--inspector-line) 0 1px,
                      transparent 0.25rem 0.5rem
                    ),
                    repeating-linear-gradient(
                      45deg,
                      var(--angled-line) 0 1px,
                      transparent 1px 0.5rem
                    );
              background-position: top left, top right, top left;
              background-repeat: repeat-y, repeat-y, repeat;
              background-size: 1px 0.4rem, 1px 0.4rem, auto;
              content: '';
              display: block;
              height: 100%;
              left: -1.5rem;
              position: absolute;
              width: 1.5rem;
            }
            #rectangle::after {
                left: auto;
                right: -1.5rem;
            }
        }
    }
}

/* single page documents */
body.simple {
    grid-template-rows: var(--header-height) auto auto;

    main {
        background: var(--bg);
        border-top: none;
        display: grid;
        gap: var(--article-gap);
        grid-template-rows: min-content auto;
        grid-template-columns: var(--article-grid);
        justify-content: center;
        justify-items: center;
        padding: var(--article-top) 1.5rem 3rem;
        width: 100%;

        > header {
            grid-column-start: 1;
            grid-column-end: 3;
            display: block;
            padding: 3rem 0 1.5rem 0;
            width: 100%;

            .lede {
                margin: 2rem 0 0;
                font-size: 1.6rem;
                font-weight: 400;
                line-height: 1.4;
            }
        }

        > section {
            grid-column-start: 1;
            grid-column-end: 3;
            font-size: 1.125rem;

            > :first-child {
                margin-top: 0;
            }

            p {
                margin: 0 0 1.5rem;

                > em:first-child {
                    color: var(--text);
                    display: block;
                    font-size: 1.25rem;
                    font-style: normal;
                    font-weight: 700;
                    line-height: 1.3;
                    padding-bottom: 0.75rem;
                }

                &:not(:has(> em:first-child)) {
                    margin-top: -0.75rem;
                }
            }
        }
    }

    section
    {
        &#studies {
            background: var(--bg);
            padding: 0 0 2rem;

            article {
                margin: 0 -1.5rem;
                width: auto;

                /* revert the click effect */
                &:has(a:active) {
                    margin: calc(0.5rem - 2px) -1.5rem 0;
                }
            }
        }
    }
}

/**
 * media queries
 **/

.tablet-show,
.laptop-show,
.display-show {
    display: none;
}

/* small height screens override */
/* FIX */
/*@media (max-height: 720px)
{
    main > header {
        grid-auto-rows: auto auto;
        height: auto;
        max-height: 100%;
        padding-bottom: 3rem;
    }
}
*/

/* make the header taller on screens > 720px high */
@media (min-height: 900px)
{
    body {
        --header-height:  5rem;
    }
}

/* bigger than phones */
@media (min-width: 441px)
{
    body#legacy
    {
        main > header {
            background-position: bottom -1px right 0;

            svg {
                left: 0;
            }
        }
    }
}

/* tablets */
@media (min-width: 640px)
{
    /* site header sizing/display */
    body > header {
        padding: 0 2rem;

        menu
        {
            span {
                display: inline;
            }

            .icon {
                display: none;
            }
        }
    }

    /* main header is now full pane */
    main {
        grid-template-rows: max(var(--hero-min), calc(100lvh - var(--header-height))) auto;

        > header {
            min-height: calc(var(--hero-min) - var(--header-height));

            > hgroup {
                margin-top: 4rem;

                .lede {
                    font-size: 1.6rem;
                    max-width: 80%;
                }
            }

            > aside {
                flex-direction: row;
                margin-bottom: 0;
                margin-top: 3rem;

                figure {
                    grid-template-columns: auto;
                    grid-template-rows: 2rem 2rem auto;
                    max-width: 16%;
                    padding-right: 1rem;

                    figcaption {
                        grid-column-start: 1;

                        &.min {
                            width: min-content;
                        }

                        span {
                            display: inline-block;
                            white-space: nowrap;
                        }
                    }
                }
            }
        }

        > article {
            figure {
                &.tablet-2\/3 img {
                    max-width: 67%;
                }
            }
        }
    }

    /* case studies list has more room */
    section#studies
    {
        article
        {
            > a {
                padding: 2rem 1.5rem;
            }

            p:first-of-type + p {
                display: block;
            }

            &#honeycomb {
                background-position: bottom -16rem right 0rem;
                background-size: auto 100%;
            }
            &#legacy {
                background-position: bottom -16rem right 2rem;
                background-size: auto 100%;
            }
        }
    }

    /* simple templates need the header fixed */
    body.simple main > header {
        min-height: auto;
    }

    /* honeycomb case study art changes */
    body#honeycomb main > header #grid {
        --shape-size: 10dvh;

        #shapes {
            grid-template-columns: 1fr 1fr 1fr;

            #triangle {
                display: none;
            }
        }
    }

    /* media query utilities */
    .tablet-show {
        display: block;
    }
    .tablet-hide {
        display: none;
    }
}

/* landscape tablets */
@media (min-width: 768px)
{
    /* article adjustments */
    main > article {
        p {
            font-size: 1.05rem;
        }
    }

    /* adjust the case study cards on the list page */
    body.simple
    {
        section#studies {
            padding-top: 2rem;

            article {
                margin-left: 0;
                margin-right: 0;
            }
        }
    }

    /* case study background handling */
    section#studies
    {
        article {
            border: 2px solid var(--hover);
            box-shadow: 0.5rem 0.5rem 0 0 var(--hover);
            width: calc(var(--column-width) + 6px);

            a {
                padding: 2rem;
            }

            p {
                max-width: 67%;
            }

            div {
                flex-direction: row;
                gap: 2rem;
            }

            /* inset the article when clicking the link; this needs !important b/c of the mx-0 above */
            &:has(a:active) {
                box-shadow: none;
                margin: 0.5rem -0.5rem -0.5rem 0.5rem !important;
            }

            &#honeycomb {
                background-position: top 10% right -35%;
                background-size: 50% auto;

                div {
                    gap: 1rem;

                    > figure {
                        max-width: 22.5%;
                    }
                }
            }
            &#legacy {
                background-position: top 2rem right 2rem;
                background-size: 25% auto;
            }
        }
    }

    /* honeycomb case study art */
    body#honeycomb main > header #grid {
        --shape-size: 14dvh;
    }
}

/* laptops (nav/article move to columns now) */
@media (min-width: 1024px)
{
    :root {
        --article-grid: 12rem var(--content-width);
        --article-gap: 3rem;
        --article-top: 2.5rem;
    }

    h1 {
        max-width: 75%;
    }

    h3 {
        #impact & {
            font-size: 1.1rem;
        }
    }

    /* site footer follows content columns now */
    body > footer
    {
        section {
            justify-content: center;
        }

        #end {
            grid-template-columns: var(--article-grid);
            gap: var(--article-gap);
            padding-bottom: 1rem;

            .text {
                grid-column-start: 2;
            }
        }

        #footnotes {
            grid-template-columns: var(--article-grid);
            gap: var(--article-gap);
            padding-bottom: 1rem;

            ul {
                grid-column-start: 2;
                margin: 0.5rem 0 0 -1.5rem;
            }

            big {
                order: 0;
                padding-top: 0;
            }
        }
    }

    /* cap the width of the main header ledes */
    main > header {
        > hgroup {
            .lede {
                max-width: 60%;
            }
        }
    }

    /* article adjustments */
    main > article
    {
        p {
            font-size: 1rem;
        }

        figure {
            &.rounded img {
                border-radius: 1rem;
            }
            &.rounded-tl img {
                border-radius: 1rem 0 0;
            }
        }
    }

    /* table of contents is now on the left of the article */
    nav {
        margin-left: 0;
        top: var(--article-top);
        width: 12rem;

        ol {
            border-top: 3px solid var(--muted);
            flex-direction: column;
            margin-top: 0.75rem;
            overflow-x: hidden;
        }

        ul {
            flex-direction: column;

            > li {
                padding: 0.4rem 0 0 0.5rem;

                a {
                    margin-left: 0.25rem;
                }

                &:first-child {
                    border-top: 1px solid var(--faded);
                }

                &:last-child {
                    border-bottom: 0;
                }
            }
        }

        li {
            height: 2.5rem;
            overflow: hidden;
            padding: 0.4rem 0 0;
            text-indent: 0.25rem;

            /* group <li> is a list item again */
            &.group {
                height: auto;
                display: list-item;
                padding: 0.4rem 0 0;

                a {
                    display: inline-block;
                    padding: 0;
                    text-indent: 0;
                }

                > a {
                    padding: 0 0 0.5rem;

                    &::before {
                        display: none;
                    }
                }

                &:has(li.active) {
                    > a {
                        color: var(--text);
                        padding-left: 0.25rem;
                    }
                }
            }

            /* active item */
            &.active
            {
                &::after {
                    display: none;
                }

                a {
                    padding-left: 0.25rem;
                }
            }
        }
    }

    /* homepage artwork moves to the right as a stack */
    body#default
    {
        main
        {
            > header {
                padding: 0 1.5rem;

                hgroup {
                    margin-top: 10dvh;
                    padding: 0;
                }

                #semicircle {
                    bottom: 57dvh;
                    height: 12dvh;
                    border-radius: 12dvh 12dvh 0 0;
                    width: 24dvh;
                    left: auto;
                    right: -1dvw;

                    &:hover {
                        transform: rotate(6deg) translateY(0.125dvh);

                        + #square {
                            transform: rotate(6deg) translateY(0.25dvh) translateX(0.5dvw);
                        }
                    }
                }

                #square {
                    bottom: 45dvh;
                    height: 12dvh;
                    width: 12dvh;
                    left: auto;
                    right: 2dvw;

                    &:has(+ #circle:hover) {
                        transform: translateX(-0.25dvw);
                    }
                }

                #circle {
                    height: 15dvh;
                    left: auto;
                    bottom: 30dvh;
                    right: 3dvw;
                    width: 15dvh;
                }

                #rectangle {
                    height: 5dvh;
                    left: auto;
                    width: 36dvw;
                    right: -16dvw;
                    bottom: 25dvh;

                    &:hover {
                        transform: rotate(-6deg) translateY(-0.125dvh);
                    }
                }

                #triangle {
                    height: 25dvh;
                    right: 6dvw;
                    width: 25dvh;
                }
            }
        }

        > footer {
            padding-left: 3rem;
            padding-right: 3rem;

            section {
                grid-template-columns: 12rem 1fr;
                justify-content: center;
            }
        }
    }

    /* case study list adjustments */
    section#studies {
        padding-left: 1.5rem;
        padding-right: 1.5rem;

        article h2 {
            font-size: 2.5rem;
        }

        article#honeycomb {
            background-position: top 10% right -5%;
            background-size: 35% auto;
        }
    }

    /* single page docs */
    body.simple main {
        padding: 10dvh 0 5dvh;

        > header {
            padding: 0 5dvw 0 5dvw; /* make this 0 10dvw 0 0 to use same left position as rest of site */
        }
        > section {
            grid-column-start: 2;

            p {
                font-size: 1rem;
            }

            &#studies {
                grid-column-start: 1;
            }
        }
    }

    /* honeycomb case study artwork now includes the triangle */
    body#honeycomb
    {
        main > header
        {
            aside {
                margin-bottom: 12dvh;
            }
            #grid {
                --shape-size: max(16dvh, 6rem);

                #shapes {
                    gap: 4rem;
                    grid-template-columns: 1fr 1fr 1fr 1fr;
                    width: var(--column-width);

                    #triangle {
                        display: block;
                    }
                }

                #circle::before,
                #rectangle::before,
                #rectangle::after {
                    left: -4rem;
                    width: 4rem;
                }
                #rectangle::after {
                    left: auto;
                    right: -4rem;
                }
            }
        }
    }
}

/* desktops */
@media (min-width: 1280px)
{
    :root {
        --content-width: min(48rem, calc(100% - 3rem));
        --column-width: min(68rem, calc(100% - 3rem));
        --article-grid: 16rem var(--content-width) 4rem;
        --article-gap: 0;
        --article-top: 3rem;
    }

    html {
        font-size: 17px;
    }

    /* move the page title down */
    main > header
    {
        > hgroup {
            margin-top: 6rem;
        }
    }

    /* homepage footer alignment */
    body#default
    {
        > footer {
            padding-left: 0;
            padding-right: 0;

            section {
                grid-template-columns: var(--article-grid);
            }
        }
    }

    /* single page docs */
    body.simple main
    {
        > header {
            padding-bottom: 3rem;
        }

        section {
            grid-column-end: 3;

            &#studies {
                grid-column-end: 4;
            }
        }
    }
}

/* displays */
@media (min-width: 1440px)
{
    :root {
        --column-width: min(72rem, calc(100% - 3rem));
        --article-grid: 16rem var(--content-width) 8rem;
        --article-top: 4rem;
    }

    html {
        font-size: 18px;
    }

    body {
        line-height: 1.6;
    }

    /* more room on the top pane and figures */
    main
    {
        > header > aside {
            gap: 2rem;
        }

        > article {
            padding-right: 0;
            padding-left: 0;

            figure {
                align-items: flex-end;
                flex-direction: row;
                gap: 2rem;

                figcaption {
                    font-size: 0.75rem;
                    position: absolute;
                    right: -9.5rem;
                    bottom: 1rem;
                    width: 8rem;
                    font-style: normal;
                }
            }
        }

        nav {
            font-size: 0.925rem;

            ol li {
                padding-top: 0.5rem;
            }
        }
    }

    /* case studies cards move beyond the edges */
    section#studies
    {
        article {
            width: calc(var(--column-width) + 4rem + 8px);

            &#honeycomb {
                div {
                    gap: 2rem;
                }
            }
        }
    }
}

@media (min-width: 1560px)
{
    :root {
        --article-grid: 17rem var(--content-width) 7rem;
    }

    /* case study card adjustments */
    section#studies {
        article#honeycomb {
            background-position: top 10% right 0;
            background-size: 30% auto;
        }
    }
}