/* ==========================================================================
   FOOTER: every rule of the red footer, on every page and at every size, in the order they apply.
   Loaded after style.css and details.css. The comment above a rule says why it is there.
   ========================================================================== */

/* ---------- Dither: a halftone seam where the page turns red ----------
   Rows of red dots grow from a pin-prick to solid red, so the black turns into the footer instead of meeting it.
   The pattern drifts sideways, slowly. */

/* the drift and the breath move the layer (translate, scale): the graphics card does it, nothing is repainted */
@keyframes dd-seam {
    to {
        translate: 24px 0;
    }
}

/* a slow breath: the dots swell upward a little and settle, the base stays fused with the footer */
@keyframes dd-seam-pulse {
    from {
        scale: 1 0.9;
    }

    to {
        scale: 1 1.07;
    }
}

.site-footer :focus-visible {
    box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px var(--ink);
}

/* Variant for controls that sit on an accent-coloured surface (header, footer) */
.btn--ink {
    border-color: var(--ink-border);
    color: var(--ink);
}

.btn--ink:hover {
    background-color: var(--ink);
    border-color: var(--ink);
    color: var(--accent-surface);
}

/* ---- Footer (always on accent, always ink text) ---- */
.site-footer {
    background-color: var(--accent-surface);
    color: var(--ink);
    padding-top: clamp(4rem, 9vw, 7rem);
    padding-bottom: clamp(2.5rem, 6vw, 5rem);
    padding-top: clamp(5rem, 12vw, 10rem);
}

.site-footer .meta,
.site-footer .meta strong {
    color: var(--ink);
}

.footer-call {
    margin-bottom: var(--space-7);
    margin-bottom: clamp(4rem, 9vw, 7rem);
}

.footer-call h2 {
    margin-block: var(--space-4) var(--space-5);
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 0.92;
    letter-spacing: -0.04em;
    text-transform: none;
}

.footer-grid {
    display: grid;
    gap: var(--space-5);
    margin-bottom: var(--space-7);
}

@media (min-width:768px) {
    .footer-grid {
        grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    }
}

.status-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--ink);
}

.status-panel__head {
    padding: var(--space-2) var(--space-4);
    background-color: var(--ink);
    color: var(--accent-surface);
    font-family: var(--font-mono);
    font-size: var(--fs-meta);
    letter-spacing: var(--tracking-meta);
    text-transform: uppercase;
}

.status-panel__body {
    flex: 1;
    padding: var(--space-4);
    font-family: var(--font-mono);
    font-size: var(--fs-small);
    letter-spacing: var(--tracking-meta);
    line-height: 1.8;
    text-transform: uppercase;
}

.status-panel__banner {
    padding: var(--space-3) var(--space-4);
    background-color: var(--ink);
    color: var(--accent-surface);
    border-top: 1px solid var(--ink);
    font-family: var(--font-mono);
    font-size: var(--fs-meta);
    font-weight: 600;
    letter-spacing: var(--tracking-meta);
    text-transform: uppercase;
}

.footer-legal {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding-top: var(--space-5);
    border-top: 1px solid var(--ink-border);
}

.footer-legal nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-5);
    column-gap: clamp(2rem, 4vw, 4rem);
    row-gap: var(--space-1);
}

.footer-legal a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.footer-legal a:hover {
    border-bottom-color: var(--ink);
}

.footer-call__lead {
    max-width: 38ch;
    margin-bottom: var(--space-6);
    font-size: var(--fs-lead);
    line-height: 1.4;
}

.site-footer .btn-row .btn {
    min-height: 3.25rem;
    padding-inline: 1.75rem;
    font-size: var(--fs-small);
}

@media (min-width:800px) and (min-height:700px) {
    .site-footer {
        max-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding-block: clamp(1.5rem, 5vh, 3.5rem);
    }

    .site-footer>.container {
        display: flex;
        flex-direction: column;
        gap: 3vh;
    }

    .footer-call {
        margin-bottom: 0;
    }

    .footer-call h2 {
        margin-block: 1.5vh 2vh;
    }

    .footer-call__lead {
        margin-bottom: 3vh;
        font-size: clamp(1rem, 2.6vh, 1.5rem);
    }

    .site-footer .btn-row .btn {
        min-height: clamp(2.5rem, 6vh, 3.25rem);
    }

    .footer-grid {
        margin-bottom: 0;
        gap: 2vh 1.5rem;
    }

    .status-panel__body {
        padding: 1.5vh 1rem;
    }

    .footer-legal {
        padding-top: 1.5vh;
    }

    .footer-legal a {
        min-height: 2.5rem;
    }
}

html.footer-in-view .devil-toggle {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

@media (max-width:760px) {
    .site-footer {
        padding-block: 1.25rem 0.75rem;
    }

    .site-footer>.container {
        gap: 0.9rem;
    }

    .footer-call h2 {
        margin-block: 0.4rem 0.5rem;
        font-size: 1.6rem;
    }

    .footer-call__lead {
        margin-bottom: 0.75rem;
        font-size: 0.95rem;
        line-height: 1.35;
    }

    .site-footer .btn-row .btn {
        min-height: 2.5rem;
        font-size: 0.6875rem;
    }

    .footer-grid {
        gap: 0.9rem;
    }

    .site-footer .sitemap {
        /* .site-footer: over the rules in details.css, loaded later */
        gap: 0.5rem;
        padding: 0.6rem 0.75rem;
    }

    .site-footer .sitemap svg {
        max-height: 6.5rem;
    }

    .site-footer .sitemap__foot {
        padding-top: 0.4rem;
    }

    .status-panel__head,
    .status-panel__banner {
        padding: 0.35rem 0.75rem;
    }

    .status-panel__body {
        padding: 0.5rem 0.75rem;
        font-size: 0.6875rem;
        line-height: 1.5;
    }

    /* the profiles on one row */
    .footer-legal {
        gap: 0.25rem 1rem;
        padding-top: 0.5rem;
    }

    .footer-legal nav {
        column-gap: 1rem;
    }

    .footer-legal a {
        min-height: 2rem;
    }
}

.site-footer {
    -webkit-font-smoothing: auto;
    -moz-osx-font-smoothing: auto;
}

.site-footer .meta,
.site-footer .btn,
.site-footer .footer-legal,
.site-footer .footer-legal a,
.site-footer .status-panel__body,
.site-footer .sitemap__foot {
    font-weight: 500;
}

@media (min-width:761px) and (max-height:760px) {
    .site-footer {
        padding-block: 1.25rem 0.75rem;
    }

    .site-footer .footer-call {
        margin-bottom: 0;
    }

    .site-footer>.container {
        gap: 1rem;
    }

    .site-footer .footer-call h2 {
        margin-block: 0.4rem 0.5rem;
        font-size: min(6vw, 9vh);
    }

    .site-footer .footer-call__lead {
        margin-bottom: 0.75rem;
        font-size: clamp(0.95rem, 2.6vh, 1.2rem);
        line-height: 1.35;
    }

    .site-footer .btn-row .btn {
        min-height: 2.5rem;
    }

    .site-footer .footer-grid {
        gap: 1rem;
        margin-bottom: 0;
    }

    .site-footer .sitemap svg {
        max-height: 7rem;
    }

    .site-footer .status-panel__body {
        padding: 0.5rem 0.75rem;
        line-height: 1.5;
    }

    .site-footer .footer-legal {
        padding-top: 0.5rem;
    }

    .site-footer .footer-legal a {
        min-height: 2rem;
    }
}

@media (min-width:761px) and (max-width:1100px),(min-width:761px) and (hover:none) {
    .site-footer .footer-call {
        margin-bottom: clamp(1rem, min(12vw, 12vh - 3rem), 8rem);
        /* less on short (landscape) screens */
    }
}

@media (max-width:760px) {
    .site-footer .footer-call {
        margin-bottom: 1.25rem;
    }

    .site-footer .footer-grid {
        margin-bottom: 0;
    }
}

@media (max-width:380px) {
    .site-footer .btn-row {
        flex-wrap: wrap;
    }

    .site-footer .btn-row .btn {
        min-height: 2.25rem;
    }

    .site-footer>.container {
        gap: 0.6rem;
    }

    .site-footer .footer-call {
        margin-bottom: 0.75rem;
    }

    .site-footer .footer-call__lead {
        margin-bottom: 0.5rem;
        font-size: 0.875rem;
    }
}

@media (hover:none) {
    html body .site-footer:has(.footer-call) {
        /* html body: over the full-screen rule in details.css */
        min-height: 0;
    }

    html body .site-footer:has(.footer-call)>.container {
        display: block;
        /* as on phones: the parts follow one another, no stretched gaps */
    }

    .site-footer .footer-grid {
        margin-bottom: 0;
    }

    .site-footer .footer-legal {
        padding-top: 0.5rem;
    }
}

@media (min-width:761px) and (max-width:1100px) and (orientation:portrait),(min-width:761px) and (hover:none) and (orientation:portrait) {
    .site-footer .footer-call {
        margin-bottom: 1.5rem;
    }
}

/* the status panel: who I am at the top, availability and place at the bottom of the panel */
.status-panel__body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--space-3);
}

.status-panel__who,
.status-panel__now {
    display: block;
}

@media (max-width:380px) {
    .site-footer .sitemap__foot {
        gap: 0.5rem;
        font-size: 0.5625rem;
        white-space: nowrap;
    }

    .site-footer .footer-legal nav {
        flex-wrap: nowrap;
        column-gap: 0.6rem;
    }

    .site-footer .footer-legal a,
    .site-footer .footer-legal>span {
        white-space: nowrap;
    }

    .site-footer .status-panel__body {
        font-size: 0.625rem;
    }
}

@media (max-width:1100px) {
    .site-footer .sitemap__foot {
        gap: 0.5rem;
        font-size: 0.5625rem;
        white-space: nowrap;
    }
}

/* Aquavit is narrower than the face the titles were tracked for (-0.025 to -0.04em): it reads best almost untouched */
body :is(h1, h2, h3, h4, .brand-name, .space__title, .footer-call h2, .project-card__title, .channel__name, .cta-band__links a,
.portrait__caption strong, .floppy__labels button strong, .spec-grid h3, .channels-title, .email-display) {
    letter-spacing: -0.005em;
}

/* FOOTER: the Devil's Details wordmark (img/wordmark.svg, inline so it takes a colour) behind the call at the top of the
   footer (heading, lead, buttons), never over the site map or the dossier: 90% of the room between the margins, in a
   red a step darker than the footer, so it is seen without competing with the text. Decorative: the name is also
   written in the dossier. */
.footer-call {
    position: relative;
    isolation: isolate;
}

.footer-call> :not(.footer-mark) {
    position: relative;
    z-index: 1;
}

.footer-call .footer-mark {
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 0;
    width: 82%;
    height: 100%;
    /* the drawing fits inside the call (it keeps its proportions), so it never reaches the dossier */
    translate: -50% 0;
}

.footer-mark {
    color: color-mix(in srgb, var(--accent-surface) 84%, var(--ink));
    pointer-events: none;
}

/* the contact page: the call is its heading only, the wordmark behind it as on the other pages */
.footer-call--short {
    margin-bottom: clamp(2rem, 5vw, 4rem);
}

@media (min-width:800px) and (min-height:700px) {
    .footer-call--short {
        margin-block: auto;
    }
}

@media (hover:none) and (min-width:381px) {
    .site-footer .btn-row .btn,
    .site-footer .footer-legal a {
        min-height: 44px;
    }
}

@media (max-width:1023px) {
    .site-footer .footer-legal,
    .site-footer .footer-legal nav {
        justify-content: center;
    }

    .site-footer .footer-legal>span {
        width: 100%;
        justify-content: center;
        text-align: center;
        letter-spacing: 0.02em;
    }
}

.footer-call h2 {
    overflow-wrap: break-word;
}

.site-footer {
    position: relative;
    overflow-x: clip;
    /* the seam drifts a few pixels past the right edge: cut there, never on top (it rises above the footer) */
}

.site-footer::before {
    content: "";
    position: absolute;
    left: -24px;
    /* one step of the pattern more on the left: it drifts by moving, not by repainting */
    right: 0;
    bottom: calc(100% - 1px);
    height: 60px;
    pointer-events: none;
    /* red dots grow until they touch, then turn into dark holes that shrink to nothing: no straight edge where the red starts */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='60'%3E%3Cg fill='%23f51e44'%3E%3Ccircle cx='0' cy='3.5' r='0.35'/%3E%3Ccircle cx='12' cy='3.5' r='0.35'/%3E%3Ccircle cx='6' cy='10.5' r='0.9'/%3E%3Ccircle cx='0' cy='17.5' r='1.5'/%3E%3Ccircle cx='12' cy='17.5' r='1.5'/%3E%3Ccircle cx='6' cy='24.5' r='2.2'/%3E%3Ccircle cx='0' cy='31.5' r='3'/%3E%3Ccircle cx='12' cy='31.5' r='3'/%3E%3Ccircle cx='6' cy='38.5' r='3.9'/%3E%3Crect y='38.5' width='12' height='21.5'/%3E%3C/g%3E%3Cg fill='%230A0A0A'%3E%3Ccircle cx='0' cy='38.5' r='2.1'/%3E%3Ccircle cx='12' cy='38.5' r='2.1'/%3E%3Ccircle cx='6' cy='45.5' r='1.3'/%3E%3Ccircle cx='0' cy='52' r='0.55'/%3E%3Ccircle cx='12' cy='52' r='0.55'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-size: 12px 60px;
    transform-origin: 50% 100%;
    will-change: translate, scale;
    animation: dd-seam 6s linear infinite, dd-seam-pulse 3.6s var(--ease-ae) infinite alternate;
    animation-play-state: paused;
    /* runs only while the footer is near the screen (details.js) */
}

.site-footer.is-near::before {
    animation-play-state: running;
}

@media (min-width:800px) and (min-height:700px) {
    .site-footer:has(.footer-call) {
        min-height: 100vh;
    }
}

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

@media (min-width:800px) and (min-height:700px) {
    .footer-call__lead {
        max-width: 52ch;
    }

    .status-panel__body {
        line-height: 1.5;
    }
}

.sitemap {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4);
    /* the same margin on every side */
    border: 1px solid var(--ink);
}

/* an X of dashes: the pages are stars at its ends, the horned head (Home) where the lines cross; the labels run underneath */
.sitemap__foot {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    font-family: var(--font-mono);
    font-size: var(--fs-meta);
    letter-spacing: var(--tracking-meta);
    text-transform: uppercase;
    padding-top: var(--space-3);
    border-top: 1px solid color-mix(in srgb, var(--ink) 35%, transparent);
    /* a hairline under the map */
}

.sitemap svg {
    width: 100%;
    height: auto;
    max-height: 13rem;
    overflow: visible;
}

.sitemap text {
    font-family: var(--font-mono);
    font-size: 8px;
    /* in map units: about 10px on screen */
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    fill: var(--ink);
}

.sitemap .is-here text {
    font-weight: 700;
}

html.dd-motion .status-panel__body[data-in] {
    clip-path: none;
    opacity: 0;
    transform: translateY(0.4rem);
    transition: opacity 0.7s var(--ease-ae) var(--in-d, 0ms), transform 0.7s var(--ease-ae) var(--in-d, 0ms);
}

html.dd-motion .status-panel__body[data-in].is-in {
    clip-path: none;
    opacity: 1;
    transform: none;
}

@media (min-width:800px) and (min-height:700px) {
    .site-footer:has(.footer-call)>.container {
        flex: 1 1 auto;
        justify-content: space-between;
    }
}

/* the map is the footer's navigation: every page on it is a link */
.sitemap a {
    cursor: pointer;
}

/* the other pages: the red of the surface, darkened with ink, so they read as off without turning grey;
   the page you are on, and any under the pointer, in ink */
.sitemap a .sitemap__node {
    fill: color-mix(in srgb, var(--ink) 40%, var(--accent-surface));
    transition: fill var(--dur-fast) var(--ease-out);
}

.sitemap a.is-here .sitemap__node {
    fill: var(--ink);
}

.sitemap a:hover .sitemap__node,
.sitemap a:focus-visible .sitemap__node {
    fill: var(--ink);
}

.sitemap a:focus-visible {
    outline: none;
}

.sitemap a:focus-visible text {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-call h2 {
    font-size: min(6.2vw, 4.75rem);
}

@media (min-width:800px) and (min-height:700px) {
    .footer-call h2 {
        font-size: min(6.2vw, 9vh, 4.75rem);
    }
}

@media all {
    :where(.nav-link, .footer-legal a, .hero__status, main p a, .btn, .cta-band__links a, .channel, .breadcrumb a) {
        --horn-h: 15px;
        position: relative;
    }

    /* the element under the pointer comes forward, so its horns lie over the text and boxes around it */
    :where(.nav-link, .footer-legal a, .hero__status, main p a, .btn, .cta-band__links a, .channel, .breadcrumb a):is(:hover, :focus-visible) {
        z-index: 20;
    }

    .footer-legal a::before {
        content: "";
        position: absolute;
        left: 50%;
        width: max(100%, calc(var(--horn-h) * 2.968));
        translate: -50% 0;
        /* links: from the top of the letters (half the box up, plus half a line), raised by a third of the way down
           to the underline at the bottom; buttons: on the top edge */
        bottom: var(--horn-at, calc((50% + 0.5em) * 4 / 3));
        height: var(--horn-h);
        background-color: var(--horn, currentColor);
        -webkit-mask: var(--horns) 50% var(--horn-h) / calc(var(--horn-h) * 2.968) var(--horn-h) no-repeat;
        mask: var(--horns) 50% var(--horn-h) / calc(var(--horn-h) * 2.968) var(--horn-h) no-repeat;
        z-index: 20;
        pointer-events: none;
        transition: -webkit-mask-position 0.3s var(--ease-out), mask-position 0.3s var(--ease-out);
    }

    .btn--ink,
    .site-footer .btn {
        --horn: var(--ink);
    }

    :is(.nav-link,.footer-legal a,.hero__status,main p a,.btn,.cta-band__links a,.channel):is(:hover,:focus-visible,:active)::before {
        -webkit-mask-position: 50% 0;
        mask-position: 50% 0;
    }
}

@media (prefers-reduced-motion:reduce) {
    .footer-legal a::before {
        transition: none;
    }
}

/* the centre label of the site map (Devil's Den) is wider than the gap between the dotted lines: a rim in the footer's
   colour cuts the lines round it, so they stop just short of the letters */
.sitemap text[x="125"] {
    paint-order: stroke;
    stroke: var(--accent-surface);
    stroke-width: 5px;
    stroke-linejoin: round;
}

.footer-call {
    text-align: center;
}

.footer-call__lead {
    margin-inline: auto;
}

.footer-call .btn-row {
    justify-content: center;
}

/* Site map: each page is one target, star and name together (an invisible box under both, bigger than either) */
.sitemap__hit {
    fill: transparent;
}

@media (hover:none) {
    .site-footer .btn,
    .site-footer .btn-row .btn,
    .site-footer .footer-legal a {
        min-height: var(--tap);
    }

    .site-footer .footer-legal a {
        display: inline-flex;
        align-items: center;
    }

    /* the site map: big enough that each page's box (star and name) is 44 px tall */
    .site-footer .sitemap svg {
        max-height: 8.75rem;
    }
}

@media (max-width:760px) {
    .site-footer {
        overflow-x: clip;
    }

    .site-footer .footer-call h2 {
        font-size: min(9.8vw, 4rem);
        line-height: 0.95;
        margin-block: 0.75rem 1rem;
    }

    .site-footer .footer-call .footer-mark {
        width: 160%;
        height: 115%;
        top: -6%;
    }

    .site-footer .btn-row {
        flex-wrap: nowrap;
        justify-content: center;
        gap: 0.35rem;
    }

    .site-footer .btn-row .btn {
        flex: 0 1 auto;
        padding-inline: 0.5rem;
        letter-spacing: 0.04em;
        white-space: nowrap;
    }

    .site-footer .status-panel__head,
    .site-footer .status-panel__banner {
        padding: 0.35rem 0.6rem;
        font-size: 0.625rem;
    }

    .site-footer .status-panel__body {
        padding: 0.5rem 0.6rem;
        font-size: 0.625rem;
        line-height: 1.55;
    }
}

@media (max-width:380px) {
    .site-footer .sitemap {
        display: flex;
    }

    .site-footer .btn-row .btn {
        padding-inline: 0.4rem;
        font-size: 0.6rem;
    }
}

/* the profiles and the CV at the foot of the footer: one row as wide as the footer, the same space between each
   (the first on the left edge, the last on the right one), at every width */
.site-footer .footer-legal nav {
    flex: 1 1 100%;
    flex-wrap: nowrap;
    justify-content: space-between;
    column-gap: 0.6rem;
}

.site-footer .footer-legal a {
    white-space: nowrap;
}

/* phones: the four keep to one row, the letters a little smaller and closer as the screen narrows */
@media (max-width:760px) {
    .site-footer .footer-legal a {
        font-size: min(0.6875rem, 2.75vw);
        letter-spacing: 0.04em;
    }
}
