/* Corner ears: an 80px ribbon at the top right of the article, flush with the corner of
   the container that holds it.

   Floated, not absolutely positioned. An earlier abspos version put the ribbon where the
   title was already painting: 299px of the first title line sat behind it at 1024px, 44px
   at 390, 37px at 320. As a float, the title's line boxes stop at the ribbon and resume at
   full width underneath it. The float has to precede the title in the DOM, which is why
   single.html renders the ear before post/info.html.

   Flush, not inset. .content wraps the article in a 2em padding band - 40px at >=1024px
   and 32px below, because poole raises the root font-size from 16px to 20px at 64em - and
   the ribbon aligned itself against the post box inside that band, leaving a 40px gap
   between it and the navbar above and another 40px to the container's right edge. A
   negative margin of the same 2rem cancels the band on the two outer sides: the top lands
   on the navbar's bottom edge (measured: navbar bottom 39 == .content top == ear top at
   1920, 52 == 52 at 900 and 320), the right lands on the container's right edge, at every
   width - the band and the margin change with the same breakpoint. rem is the honest unit
   for "the same 2em the container padded", because rem tracks the root font-size exactly.

   The text protection is untouched: a float reserves its margin box, whose left edge is
   still the 20px left margin away from the visible ribbon, so no line of text ever reaches
   the graphic. Measured 0px overlap between title lines and the ribbon at 1920, 1700,
   1440, 1300, 1024, 900, 776, 560, 390 and 320, with both ear variants. */
a.github-corner,
a.instructables-corner {
    float: right;
    width: 80px;
    height: 80px;
    /* -2rem cancels the container's 2em padding band on the right side. The top needs
       more arithmetic: .spacer-nav (navbar.css) starts the article at 39px above 64em and
       52px below it, which only clears the fixed 55px navbar because the 2em padding then
       adds 40/32px more before the text. Pulling the ear up the full band parked its top
       16px (desktop) or 3px (small) BEHIND the fixed bar - the clip. The bar's bottom edge
       is the real top of the visible page: 55 - (39 + 40) = -24px above 64em,
       55 - (52 + 32) = -29px below it. Measured after: ribbon top 55.0 == bar bottom 55.0
       at 1920, 1370, 1024, 900, 776, 560, 390 and 320. */
    margin: -29px -2rem 14px 20px;
}

@media (min-width: 64em) {
    a.github-corner,
    a.instructables-corner {
        margin-top: -24px;
    }
}

a.github-corner svg,
a.instructables-corner svg {
    display: block;
    border: 0;
}

a.github-corner:focus-visible,
a.instructables-corner:focus-visible {
    outline: 2px solid var(--link-color);
    outline-offset: 3px;
    border-radius: 4px;
}

.github-corner:hover .octo-arm {
    animation: octocat-wave 560ms ease-in-out;
}

@keyframes octocat-wave {
    0% {
        transform: rotate(0deg);
    }

    20% {
        transform: rotate(-25deg);
    }

    40% {
        transform: rotate(10deg);
    }

    60% {
        transform: rotate(-25deg);
    }

    80% {
        transform: rotate(10deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

@media (max-width: 500px) {
    .github-corner:hover .octo-arm {
        animation: none;
    }

    .github-corner .octo-arm {
        animation: octocat-wave 560ms ease-in-out;
    }
}

/* Instructables ear. Same ribbon, and the mark is knocked out of it in the page
   colour exactly as the octocat's paths are; partials/post/instructables-corner.html
   turns it 45deg so it stands square to the fold. No animation - it is a silhouette,
   not a creature with an arm to wave. */
.instructables-mark {
    color: var(--bkg-color);
}

/* Reduced motion: the waving arm is the only motion in these ears, and it waves on
   hover at desktop widths and permanently below 500px. */
@media (prefers-reduced-motion: reduce) {
    .github-corner .octo-arm,
    .github-corner:hover .octo-arm {
        animation: none !important;
    }
}
