/* COMPONENTS: small reusable pieces used across pages */

.pulse {
    position: relative;
    width: 12px;
    aspect-ratio: 1 / 1;
    background-color: #22c55e;
    border-radius: 50%;
}

.pulse::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background-color: #22c55e;
    animation: ripple 1.5s ease-out infinite;
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(2.25);
        opacity: 0;
    }
}

.checkerboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    border: var(--hashmark);
    border-radius: var(--radius);
}

.checkerboard > * {
    width: 24px;
    aspect-ratio: 1 / 1;
    background: #f5f5f52e;
}

.checkerboard > .filled {
    background: var(--figure-bg);
}

/* PAGINATION */
main > section > .pagination {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: calc(var(--text-gap) / 2);
    line-height: 1;
    width: auto;
    margin-inline: calc(var(--padding-x) * -1);
    padding: calc(var(--padding-y) / 2) var(--padding-x);
}

/* top nav */
main > section > .pagination:has(+ [data-paginate]) {
    justify-content: flex-end;
    border-bottom: var(--hashmark);
    margin-top: calc(var(--padding-y) * -3);   /* eat the section's top padding */
    margin-bottom: var(--padding-y);
}

/* bottom nav */
main > section > [data-paginate] ~ .pagination {
    justify-content: center;
    border-top: var(--hashmark);
    border-bottom: none;   /* the footer's top line closes it */
    margin-top: auto;      /* sits on the footer when the list is short */
    margin-bottom: calc(var(--padding-y) * -3);
}

main > section > [data-paginate]:has(~ .pagination) {
    margin-bottom: var(--padding-y);
}

/* drop bottom border; fill the space down to the footer */
main > section:has(> [data-paginate] ~ .pagination) {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    border-bottom: none;
}

main > section > .pagination > a {
    display: block;
    padding: 4px 6px;
    line-height: 1;
    color: var(--muted-color);
}

main > section > .pagination > a[aria-current] {
    color: var(--text-color);
    font-weight: 700;
}

main > section > .pagination > a:focus-visible {
    outline: 1px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: var(--radius);
}

/* FIGURE: framed box with the caption as a tab (build card blue) in the
   top-left corner, styled like the showcase tag labels.
   Markup (the same shape everywhere):

       <figure>
           <img src="..." alt="...">
           <figcaption>...</figcaption>
       </figure>

   - Notes and builds: the parser writes this. A markdown paragraph that is
     only an image, ![caption](src), becomes a <figure> (render.rs,
     Block::Paragraph). The alt text is the <figcaption>, and there is no
     <figcaption> when the alt text is empty.
   - Homepage: written by hand in src/content/home.html (showcase).
   Page-specific sizing goes in that page's file (e.g. home.css). */
figure {
    position: relative;
    display: grid;
    align-content: center;
    width: 100%;
    padding: calc(var(--padding-y) * 3) var(--padding-x);
    border: var(--hashmark);
    border-radius: var(--radius);
}

figure > img {
    display: block;
    width: 100%;
    height: auto;
}

/* invert svg line art from black to white */
figure > img[src$=".svg" i] {
    filter: invert(1);
}

/* matches the showcase tag labels (STATUS, SERIAL, ...): h6 size, muted */
figure > figcaption {
    position: absolute;
    top: 0;
    left: 0;
    max-width: 60%;
    padding: 4px var(--padding-y);
    background: var(--figure-bg);
    border-right: var(--hashmark);
    border-bottom: var(--hashmark);
    border-top-left-radius: var(--radius);
    color: var(--muted-color);
    font-family: "Lato", sans-serif;
    font-size: var(--text-tag);
    font-weight: 400;
    line-height: 1.6;
}
