/* ==========================================================================
   core.css - shared styles for joeyvilleneuve.ca and overplus.ca
   Each site's site.css loads after this and sets the palette tokens below.

   Fonts: Archivo for text, IBM Plex Mono only for labels and buttons. 12px min.
   Accent colour is only for squares and lines, never text or text backgrounds.
   ========================================================================== */

/* TOKENS ---------------------------------------------------------------------
   site.css sets these for light and [data-theme="dark"]:
     --ink --paper            brand neutrals
     --accent                 accent colour
     --accent-strong          accent on controls (switch thumb), needs 3:1 on --ground
     --ground --figure        background, text
     --muted                  secondary text
     --rule                   decorative lines
     --line                   control borders, link underlines
     --raised                 panels, cards, footer
     --media                  behind images and video
     --grain-blend --grain-opacity
   It can also override anything in :root below. */
:root {
    --sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --wrap: 80rem;
    --gutter: clamp(1.25rem, 4vw, 3rem);
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* BASE ---------------------------------------------------------------------*/
*, *::before, *::after {
    box-sizing: border-box;
}
html {
    -webkit-text-size-adjust: 100%;
    background: var(--ground);
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;   /* so anchor jumps clear the sticky header */
    scrollbar-gutter: stable;   /* stops the page shifting when a dialog hides the scrollbar */
}
/* full height so the footer stays at the bottom */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    background: var(--ground);
    color: var(--figure);
    font-family: var(--sans);
    font-size: clamp(1rem, 0.95rem + 0.2vw, 1.0625rem);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
main {
    flex: 1;
}
img, video {
    display: block;
    max-width: 100%;
    height: auto;
}
h1, h2, h3 {
    text-wrap: balance;
}
p {
    text-wrap: pretty;
}
[hidden] {
    display: none !important;
}
::selection {
    background: var(--accent);
    color: var(--ink);
}
:focus-visible {
    outline: 2px solid var(--figure);
    outline-offset: 3px;
}
html:has(dialog[open]) {
    overflow: hidden;
}

/* noise texture overlay. keep --grain-opacity under ~0.25 in light mode or it hurts text contrast */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 99;
    pointer-events: none;
    opacity: var(--grain-opacity);
    mix-blend-mode: var(--grain-blend);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.2'/%3E%3C/svg%3E");
}

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.label {
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--muted);
}

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

.skip {
    position: absolute;
    left: var(--gutter);
    top: -5rem;
    z-index: 100;
    padding: 0.65rem 0.9rem;
    font: 500 0.75rem/1 var(--mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ground);
    background: var(--figure);
    text-decoration: none;
}
.skip:focus {
    top: 0.75rem;
}

/* accent square */
.sq {
    display: inline-block;
    flex: none;
    width: 7px;
    height: 7px;
    background: var(--accent);
}
.kicker {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
}

.panel {
    background: var(--raised);
    border: 1px solid var(--rule);
}

/* BUTTONS ------------------------------------------------------------------*/
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1.15rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--figure);
    background: transparent;
    border: 1px solid var(--figure);
    border-radius: 0;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
.btn--solid {
    background: var(--figure);
    color: var(--ground);
}
/* hover styles all go inside (hover: hover) so they don't stick after a tap on touch screens */
@media (hover: hover) {
    .btn:hover {
        background: var(--figure);
        color: var(--ground);
    }
    .btn--solid:hover {
        background: transparent;
        color: var(--figure);
    }
}
.btn--solid::before {
    content: "";
    flex: none;
    width: 0.5rem;
    height: 0.5rem;
    background: var(--accent);
}
.btn--small {
    padding: 0.7rem 0.85rem;
}

/* LINKS --------------------------------------------------------------------*/
.text-link {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--line);
    text-decoration-thickness: max(1px, 0.06em);
    text-underline-offset: 0.18em;
    transition: text-decoration-color 0.2s;
}
@media (hover: hover) {
    .text-link:hover {
        text-decoration-color: var(--accent);
    }
}

/* arrow after external links (not used on buttons), nudges up and right on hover */
.arrow {
    display: inline-block;
    transition: transform 0.25s var(--ease);
}

/* clickable boxes get a 2px outline on hover (border + 1px box-shadow, so nothing shifts) */
@media (hover: hover) {
    a:hover .arrow {
        transform: translate(2px, -2px);
    }
    .filter:hover,
    .card:hover,
    .pub:hover,
    .pager__link:hover,
    .menu-button:hover {
        border-color: var(--figure);
        box-shadow: 0 0 0 1px var(--figure);
    }
}

/* accent underline that grows in on hover */
.nav__link,
.rule-link {
    color: var(--figure);
    text-decoration: none;
    background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat;
    transition: background-size 0.25s var(--ease);
}
@media (hover: hover) {
    .nav__link:hover,
    .rule-link:hover {
        background-size: 100% 2px;
    }
}

/* MASTHEAD -----------------------------------------------------------------*/
.masthead {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--ground);
    border-bottom: 1px solid var(--rule);
}
.masthead__inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
    min-height: 3.75rem;
}

.nav {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 2.4vw, 2rem);
}
.nav__link {
    padding: 0.45rem 0;
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* mobile only (see RESPONSIVE) */
.menu-button {
    display: none;
    padding: 0.6rem 0.85rem;
    font: 500 0.75rem/1 var(--mono);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--figure);
    background: none;
    border: 1px solid var(--line);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.menu-button[aria-expanded="true"] {
    border-color: var(--figure);
}

/* light/dark switch. the thumb shows the state, so it uses --accent-strong for 3:1 contrast */
.mode {
    --w: 2.6rem;
    --h: 1.35rem;
    --pad: 3px;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0;
    padding: 0.4rem 0;
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    background: none;
    border: 0;
    cursor: pointer;
}
.mode__track {
    position: relative;
    flex: none;
    width: var(--w);
    height: var(--h);
    border: 1.5px solid var(--figure);
    transition: background-color 0.2s;
}
@media (hover: hover) {
    .mode:hover .mode__track {
        background: color-mix(in srgb, var(--figure) 8%, transparent);
    }
}
.mode__thumb {
    position: absolute;
    top: var(--pad);
    left: var(--pad);
    width: calc(var(--h) - 3px - 2 * var(--pad));
    height: calc(var(--h) - 3px - 2 * var(--pad));
    background: var(--accent-strong);
    transition: transform 0.3s var(--ease);
}
.mode[aria-checked="true"] .mode__thumb {
    transform: translateX(calc(var(--w) - var(--h)));
}
.mode__label {
    transition: color 0.2s;
}
.mode[aria-checked="false"] .mode__label--light,
.mode[aria-checked="true"] .mode__label--dark {
    color: var(--figure);
}

/* OVERPLUS MARK ------------------------------------------------------------
   Inline SVG of the logo, used on both sites. The right tile is always red,
   the rest use --mark-tile (defaults to --figure). core.js adds .is-flipping
   when the parent link or button is hovered. */
.mark {
    display: block;
    flex: none;
    width: 24px;
    height: 24px;
}
.mark rect {
    fill: var(--mark-tile, var(--figure));
    transform-box: fill-box;
    transform-origin: center;
}
.mark rect:nth-child(4) {
    fill: #FC0345;
}
/* stagger: left tile first, then the middle column, then the red tile */
.mark.is-flipping rect {
    animation: mark-flip 0.45s 90ms cubic-bezier(0.55, 0, 0.25, 1) both;
}
.mark.is-flipping rect:nth-child(2) {
    animation-delay: 0s;
}
.mark.is-flipping rect:nth-child(4) {
    animation-delay: 180ms;
}
/* half turn, a square looks the same when it lands */
@keyframes mark-flip {
    to { transform: scaleX(-1); }
}
/* Windows high contrast mode */
@media (forced-colors: active) {
    .mark {
        forced-color-adjust: none;
    }
    .mark rect {
        fill: CanvasText;
    }
}

/* SECTIONS -----------------------------------------------------------------*/
.section {
    padding-top: clamp(4.5rem, 10vw, 7.5rem);
}
.section__head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
    gap: 1rem 3rem;
    margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
    padding-top: 1.1rem;
    border-top: 1px solid var(--rule);
}
.section__index {
    margin: 0 0 0.9rem;
}
.section__head h1,
.section__head h2,
.footer__contact h2 {
    margin: 0;
    font-size: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    word-spacing: 0.05em;
    line-height: 0.95;
}
.section__intro {
    justify-self: end;
    max-width: 44ch;
    margin: 0;
    color: var(--muted);
}

/* FILTERS ------------------------------------------------------------------*/
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.filter {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    font: 500 0.75rem/1 var(--mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--figure);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 0;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.filter[aria-pressed="true"] {
    color: var(--ground);
    background: var(--figure);
    border-color: var(--figure);
}
.filter[aria-pressed="true"]::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    background: var(--accent);
}
.filters__count {
    margin: 1rem 0 1.25rem;
}

/* PROJECT CARDS ------------------------------------------------------------
   Poster image, plus a looping video preview on mouse hover (core.js). */
.projects {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
    gap: 1.25rem;
}
.card {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    background: var(--raised);
    border: 1px solid var(--rule);
    border-radius: 0;
    cursor: pointer;
    /* no lift on hover, or the pointer can end up off the edge of the card */
    transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
    animation: rise 0.6s var(--ease) backwards;
    animation-delay: calc(var(--i, 0) * 40ms);
}
.card__media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--media);
}
.card__poster,
.card__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card__video {
    z-index: 1;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.card.is-playing .card__video {
    opacity: 1;
}
.card__number {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.45rem;
    font: 500 0.75rem/1.3 var(--mono);
    letter-spacing: 0.08em;
    color: var(--paper);
    background: var(--ink);
}
.card.is-playing .card__number::before {
    content: "";
    width: 6px;
    height: 6px;
    background: var(--accent);
}
.card__body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1rem 1.1rem 1.15rem;
}
.card__title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.card__tech {
    font-size: 0.875rem;
    color: var(--muted);
}

/* PROJECT POPUP ------------------------------------------------------------*/
.modal {
    width: min(100% - 2 * var(--gutter), 52rem);
    max-width: none;
    max-height: calc(100% - 2rem);
    margin: auto;
    padding: 0;
    color: var(--figure);
    overflow: auto;
    overscroll-behavior: contain;
}
/* backdrop colour is set in site.css, ::backdrop doesn't reliably inherit custom properties */
.modal[open] {
    animation: sheet-in 0.35s var(--ease);
}
.modal__inner {
    padding: clamp(1.1rem, 3vw, 2rem);
}
.modal__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.modal__title {
    margin: 0.9rem 0 1rem;
    font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 0.95;
}
.modal__media {
    margin-bottom: 1rem;
    background: var(--media);
}
.modal__media video {
    width: 100%;
    height: auto;
    max-height: 62vh;
    margin: 0 auto;
    object-fit: contain;
}
.modal__tech {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}
.modal__body {
    max-width: 62ch;
    margin: 0.75rem 0 0;
    color: var(--muted);
}
.modal__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

/* PUBLICATIONS -------------------------------------------------------------
   The title link's ::after covers the card, so the whole card is clickable. */
.pubs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr));
    gap: 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.pub {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.4rem 1.5rem 1.5rem;
    background: var(--raised);
    border: 1px solid var(--rule);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.pub__title {
    margin: 0.3rem 0 0;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.015em;
}
.pub__link {
    color: inherit;
    text-decoration: none;
}
.pub__link::after {
    content: "";
    position: absolute;
    inset: 0;
}
/* focus ring goes on the whole card */
@supports selector(:has(*)) {
    .pub__link:focus-visible {
        outline: none;
    }
    .pub:has(.pub__link:focus-visible) {
        outline: 2px solid var(--figure);
        outline-offset: 3px;
    }
    .pub:has(.pub__link:focus-visible) .pub__cta {
        color: var(--ground);
        background: var(--figure);
    }
}
.pub__authors,
.pub__venue {
    margin: 0;
    font-size: 0.95rem;
    color: var(--muted);
}
.pub__authors strong {
    color: var(--figure);
    font-weight: 600;
}
/* "Read on ..." button. just a visual cue since the whole card is the link */
.pub__foot {
    margin: auto 0 0;
    padding-top: 1rem;
}
@media (hover: hover) {
    .pub:hover .pub__cta {
        color: var(--ground);
        background: var(--figure);
    }
}
/* "Read the note" is a real link, so it has to sit above the stretched title link */
.pub__foot:has(.pub__note) {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.pub__note {
    position: relative;
    z-index: 1;
}

/* NOTES --------------------------------------------------------------------
   Front page list, one row per note (cover, excerpt, "Read more").
   Older notes stay hidden until "Show older" is clicked (core.js). */
.entries {
    margin: 0;
    padding: 0;
    list-style: none;
}
.entry {
    display: grid;
    grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
    align-items: start;
    gap: 1.25rem clamp(1.5rem, 4vw, 3rem);
    padding-block: clamp(1.25rem, 3vw, 1.75rem);
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--rule);
    animation: rise 0.6s var(--ease) backwards;
    animation-delay: calc(var(--i, 0) * 40ms);
}
.entries > li:first-child .entry {
    padding-top: 0;
}
/* no cover, text gets the full width */
.entry--text {
    grid-template-columns: minmax(0, 1fr);
}
.entry__media {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--media);
    border: 1px solid var(--rule);
}
.entry__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.entry__body {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.entry__title {
    font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}
.entry__text {
    display: -webkit-box;
    max-width: 62ch;
    overflow: hidden;
    color: var(--muted);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}
.entry__more {
    align-self: flex-start;
    margin-top: 0.3rem;
    padding: 0.2rem 0;
    color: var(--figure);
    background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat;
    transition: background-size 0.25s var(--ease);
}
@media (hover: hover) {
    .entry:hover .entry__more {
        background-size: 100% 2px;
    }
}
.entries__older {
    margin-top: 1.5rem;
}

/* NOTE PAGE ----------------------------------------------------------------*/
.note {
    padding-top: clamp(2.5rem, 7vw, 5rem);
}
.note__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.6rem;
    margin: 0;
}
.note__meta .rule-link {
    padding: 0.2rem 0;
}
/* draft badge, only shows in the local preview */
.note__draft {
    padding: 0.15rem 0.45rem;
    color: var(--ground);
    background: var(--figure);
}
.note__title {
    max-width: 22ch;
    margin: 1rem 0 0;
    font-size: clamp(2.25rem, 1.4rem + 3.6vw, 4.25rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    word-spacing: 0.05em;
    line-height: 0.95;
}
.note__summary {
    max-width: 40ch;
    margin: 1.25rem 0 0;
    font-size: clamp(1.2rem, 1rem + 0.8vw, 1.55rem);
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -0.015em;
}
.note__cover {
    max-width: 42rem;
    margin: clamp(2rem, 5vw, 3rem) 0 0;
}
.note__cover img,
.prose figure img,
.prose figure video {
    width: 100%;
    background: var(--media);
    border: 1px solid var(--rule);
}
/* cap the height so tall covers don't take up the whole screen */
.note__cover img {
    width: auto;
    max-width: 100%;
    max-height: 32rem;
}
/* reserve 16:9 until the video loads */
.prose figure video {
    aspect-ratio: auto 16 / 9;
}
.note__cover figcaption,
.prose figcaption {
    margin-top: 0.6rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--muted);
}
.note__sign {
    max-width: 42rem;
    margin: 2rem 0 0;
    font-weight: 600;
}

/* note body */
.prose {
    max-width: 42rem;
    margin-top: clamp(2rem, 5vw, 3rem);
    font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
    line-height: 1.7;
}
.prose > * {
    margin: 0;
}
.prose > * + * {
    margin-top: 1.15em;
}
.prose h2 {
    margin-top: 2em;
    font-size: clamp(1.45rem, 1.2rem + 1vw, 1.9rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}
.prose h3 {
    margin-top: 1.75em;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.25;
}
.prose h2 + *,
.prose h3 + * {
    margin-top: 0.6em;
}
.prose ul,
.prose ol {
    padding-left: 1.4em;
}
.prose li + li {
    margin-top: 0.35em;
}
/* accent square bullets */
.prose ul {
    list-style: none;
}
.prose ul > li {
    position: relative;
}
.prose ul > li::before {
    content: "";
    position: absolute;
    top: 0.7em;
    left: -1.15em;
    width: 7px;
    height: 7px;
    background: var(--accent);
}
.prose ol > li::marker {
    font-family: var(--mono);
    font-size: 0.85em;
    color: var(--muted);
}
.prose blockquote {
    padding-left: 1.1em;
    color: var(--muted);
    border-left: 2px solid var(--accent);
}
.prose blockquote > * {
    margin: 0;
}
.prose blockquote > * + * {
    margin-top: 0.8em;
}
.prose strong {
    font-weight: 700;
}
.prose code {
    padding: 0.1em 0.3em;
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--raised);
    border: 1px solid var(--rule);
}
.prose pre {
    overflow-x: auto;
    padding: 1rem 1.1rem;
    font-size: 0.9rem;
    line-height: 1.55;
    background: var(--raised);
    border: 1px solid var(--rule);
}
.prose pre code {
    padding: 0;
    font-size: inherit;
    background: none;
    border: 0;
}
.prose hr {
    margin-block: 2.25em;
    border: 0;
    border-top: 1px solid var(--rule);
}
.prose > figure,
.prose > .gallery,
.prose > figure + *,
.prose > .gallery + * {
    margin-top: 2em;
}
/* images on back-to-back lines in a note go side by side */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: 1rem;
}
.gallery figure {
    margin: 0;
}

/* older/newer links at the bottom of a note */
.pager {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-top: clamp(3rem, 7vw, 4.5rem);
    padding-top: 1.1rem;
    border-top: 1px solid var(--rule);
}
.pager__link {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.1rem 1.15rem;
    color: inherit;
    text-decoration: none;
    background: var(--raised);
    border: 1px solid var(--rule);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.pager__link--newer {
    grid-column: 2;
    text-align: right;
}
.pager__title {
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.25;
}
.note__back {
    margin: 1.5rem 0 0;
}

/* FOOTER -------------------------------------------------------------------*/
.footer {
    margin-top: clamp(5rem, 11vw, 8rem);
    background: var(--raised);
    border-top: 1px solid var(--rule);
}
.footer__contact {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 1.75rem 3rem;
    padding-block: clamp(2.25rem, 5vw, 3.5rem);
}
.footer__meta {
    max-width: 44ch;
    margin: 1.25rem 0 0;
    font-style: normal;
    color: var(--muted);
}
.footer__meta p {
    margin: 0;
}
.footer__meta .text-link {
    color: var(--figure);
}
.footer__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.footer__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 2rem;
    padding-block: 1.1rem 1.3rem;
    border-top: 1px solid var(--rule);
}
/* link to the other site */
.footer__sibling {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 0;
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--figure);
    text-decoration: none;
}

/* 404 ----------------------------------------------------------------------*/
.lost {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 1.25rem;
    min-height: calc(100vh - 3.75rem);
    min-height: calc(100svh - 3.75rem);
    padding-block: 3rem;
}
.lost h1 {
    margin: 0;
    font-size: clamp(2.75rem, 1.75rem + 6vw, 8rem);
    font-weight: 800;
    letter-spacing: -0.055em;
    word-spacing: 0.08em;
    line-height: 0.88;
}
.lost p:not(.label) {
    max-width: 40ch;
    margin: 0;
    font-size: 1.1rem;
    color: var(--muted);
}

/* MOTION -------------------------------------------------------------------*/
@keyframes rise {
    from { opacity: 0; transform: translateY(20px); }
}
@keyframes sheet-in {
    from { opacity: 0; transform: translateY(1.5rem); }
}
@keyframes fade-in {
    from { opacity: 0; }
}

/* RESPONSIVE ---------------------------------------------------------------*/
@media (max-width: 900px) {
    .section__head {
        grid-template-columns: minmax(0, 1fr);
    }
    .section__intro {
        justify-self: start;
    }
    .footer__contact {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 760px) {
    /* nav becomes a dropdown under the header */
    .menu-button {
        display: inline-flex;
    }
    .nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.25rem var(--gutter) 1.25rem;
        background: var(--ground);
        border-bottom: 1px solid var(--rule);
        visibility: hidden;
        opacity: 0;
        transform: translateY(-0.5rem);
        transition: opacity 0.2s, transform 0.2s, visibility 0s 0.2s;
    }
    .nav.is-open {
        visibility: visible;
        opacity: 1;
        transform: none;
        transition: opacity 0.2s, transform 0.2s;
    }
    .nav__link {
        padding: 0.9rem 0;
        font-size: 0.8rem;
        background: none;
        border-bottom: 1px solid var(--rule);
    }
    .nav .mode {
        margin-top: 1rem;
    }

    /* two columns of buttons, with an odd count the first one gets its own row */
    .footer__buttons {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .footer__buttons .btn {
        justify-content: center;
    }
    .footer__buttons > :first-child:nth-last-child(odd) {
        grid-column: 1 / -1;
    }
    .footer__bar {
        gap: 0.4rem 1rem;
    }

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

    .pager {
        grid-template-columns: minmax(0, 1fr);
    }
    .pager__link--newer {
        grid-column: auto;
        text-align: left;
    }
}

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