/*
 * The base every theme builds on: structure, the media and reader components, and
 * accessibility. Colours, type and layout come from the tokens below, which each
 * theme in themes/ sets for light and dark. On its own, this is plain and readable.
 */
:root {
    color-scheme: light dark;
    --font-body: Georgia, 'Times New Roman', serif;
    --font-heading: var(--font-body);
    --font-mono: ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
    --bg: #fff;
    --fg: #1b1b1b;
    --muted: #555;
    --accent: #1a56db;
    --accent-fg: #fff;
    --border: #d4d4d4;
    --surface: #f4f4f4;
    --header-bg: var(--bg);
    --header-fg: var(--fg);
    --header-accent: var(--accent);
    --focus: var(--accent);
    --measure: 42rem;
    --wide: 64rem;
    --gutter: 1rem;
    --radius: 4px;

    /* The shared grammar. Themes change the voice (fonts, colours, borders), not these steps. */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --text-xs: 0.8rem;
    --text-sm: 0.9rem;
    --text-md: 1rem;
    --text-lg: 1.25rem;

    /* Buttons and fields. A theme may set any of them; the fallbacks follow its colours. */
    --control-bg: var(--surface);
    --control-fg: var(--fg);
    --control-border: color-mix(in srgb, var(--fg) 45%, var(--bg));
    --control-radius: var(--radius);
    --control-pad-y: 0.35em;
    --control-pad-x: 0.8em;
    --field-bg: var(--bg);
    --field-fg: var(--fg);

    /* Behind a logo where the header is dark: a logo is drawn for one background. */
    --logo-plate: transparent;
    --logo-plate-pad: 0;

    /* Marks for messages. They colour a rule or a border, never the text itself. */
    --ok: #1f7a4d;
    --danger: #b3261e;

    /* Motion is short and never needed to understand the page. */
    --motion-fast: 120ms;
    --motion: 180ms;
    --ease: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121212;
        --fg: #e8e8e8;
        --muted: #aaa;
        --accent: #8ab4f8;
        --accent-fg: #121212;
        --border: #3a3a3a;
        --surface: #1e1e1e;
        --ok: #6fcf97;
        --danger: #ff8a80;
        --logo-plate: #f4f2ec;
        --logo-plate-pad: 0.3rem 0.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --motion-fast: 0s;
        --motion: 0s;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.6;
    overflow-wrap: break-word;
}

/* The page fills the window: with little to read, the content stretches and the footer
   sits at the bottom edge instead of halfway up. */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.site-content {
    flex: 1 0 auto;
}

/* The commit staging runs (base.html.twig; never in production): small and quiet in the
   bottom right corner, as in the admin, and out of the page's flow. */
/* The admin's way from a page to its editor: small, in the theme's own link style. */
.admin-edit {
    margin: 0 0 1rem;
    font-size: 0.85rem;
}

body > small {
    position: fixed;
    right: 0.5rem;
    bottom: 0.25rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

body > small a {
    color: var(--muted);
    text-decoration: none;
}

body > small a:hover,
body > small a:focus-visible {
    color: var(--fg);
    text-decoration: underline;
}

a {
    color: var(--accent);
    text-underline-offset: 0.15em;
    transition: color var(--motion-fast) var(--ease), background-color var(--motion-fast) var(--ease);
}

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

/* The header has its own colours in some themes, so the ring takes the text's. */
.site-header :focus-visible {
    outline-color: currentcolor;
}

.skip-link {
    position: absolute;
    top: -10rem;
    left: var(--gutter);
    z-index: 10;
    padding: 0.5rem 0.75rem;
    background: var(--accent);
    color: var(--accent-fg);
}

.skip-link:focus {
    top: 0.5rem;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    line-height: 1.2;
}

code,
pre,
kbd {
    font-family: var(--font-mono);
}

pre {
    overflow-x: auto;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: var(--surface);
}

blockquote {
    margin: 1.5rem 0;
    padding: 0.25rem 0 0.25rem 1rem;
    border-left: 4px solid var(--border);
    color: var(--muted);
}

table {
    border-collapse: collapse;
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

th,
td {
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--surface);
}

:is(th, td) > :first-child {
    margin-top: 0;
}

:is(th, td) > :last-child {
    margin-bottom: 0;
}

:not(pre) > code {
    padding: 0.1em 0.3em;
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 0.9em;
}

/* Long lines wrap instead of scrolling: a scrolling box that the keyboard can't reach
   fails WCAG, and on a phone most code lines are long. */
pre {
    font-size: 0.9em;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
}

/*
 * Buttons and fields, for every theme. Inside :where() these weigh nothing, so any
 * component or theme rule wins without a fight. States: hover, pressed, focus (the
 * ring above), disabled, busy.
 */
:where(button, input[type='submit'], input[type='button'], .button) {
    display: inline-block;
    margin: 0;
    padding: var(--control-pad-y) var(--control-pad-x);
    border: 1px solid var(--control-border);
    border-radius: var(--control-radius);
    background: var(--control-bg);
    color: var(--control-fg);
    font: inherit;
    font-size: var(--text-sm);
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color var(--motion-fast) var(--ease),
        border-color var(--motion-fast) var(--ease),
        color var(--motion-fast) var(--ease),
        transform var(--motion-fast) var(--ease);
}

:where(button, input[type='submit'], input[type='button'], .button):where(:hover) {
    border-color: var(--control-fg);
    background: color-mix(in srgb, var(--control-fg) 10%, var(--control-bg));
}

:where(button, input[type='submit'], input[type='button'], .button):where(:active) {
    background: color-mix(in srgb, var(--control-fg) 18%, var(--control-bg));
    transform: translateY(1px);
}

/* The one main action on a page or in a form. */
:where(.button-primary) {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-fg);
    font-weight: 600;
}

:where(.button-primary):where(:hover) {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 86%, var(--fg));
}

:where(.button-primary):where(:active) {
    background: color-mix(in srgb, var(--accent) 76%, var(--fg));
}

/* A link dressed as a button takes the button's colours, not the link colour. */
a.button {
    color: var(--control-fg);
}

a.button-primary {
    color: var(--accent-fg);
}

/* Something that can't be undone. */
:where(.button-danger) {
    border-color: var(--danger);
}

:where(button, input, select, textarea):where(:disabled),
:where(button[aria-disabled='true']) {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

:where(button[aria-busy='true']) {
    cursor: progress;
}

:where(input:not([type='checkbox'], [type='radio'], [type='file'], [type='color'], [type='range'], [type='submit'], [type='button'], [type='hidden']), select, textarea) {
    max-width: 100%;
    margin: 0;
    padding: var(--control-pad-y) 0.6em;
    border: 1px solid var(--control-border);
    border-radius: var(--control-radius);
    background: var(--field-bg);
    color: var(--field-fg);
    font: inherit;
    font-size: var(--text-sm);
    line-height: 1.4;
    transition: border-color var(--motion-fast) var(--ease);
}

:where(input:not([type='checkbox'], [type='radio'], [type='file'], [type='color'], [type='range'], [type='submit'], [type='button'], [type='hidden']), select, textarea):where(:hover) {
    border-color: var(--field-fg);
}

:where(input, select, textarea):where([aria-invalid='true']) {
    border-color: var(--danger);
    outline: 1px solid var(--danger);
}

:where(input[type='checkbox'], input[type='radio']) {
    accent-color: var(--accent);
}

:where(input[type='file']) {
    max-width: 100%;
    font: inherit;
    font-size: var(--text-sm);
}

:where(textarea) {
    resize: vertical;
}

/* Messages after an action. The text keeps the page's colours; the rule says which kind. */
.notice {
    margin: var(--space-4) 0;
    padding: var(--space-3) var(--space-4);
    border-left: 4px solid var(--accent);
    background: var(--surface);
    color: var(--fg);
}

.notice-ok {
    border-left-color: var(--ok);
}

.notice-error {
    border-left-color: var(--danger);
}

/* The frame: header, content, footer. Themes can rearrange it freely. */
.site-header {
    padding: 1rem var(--gutter);
    background: var(--header-bg);
    color: var(--header-fg);
}

/* Their text lines up: the content and footer carry their gutters inside their width. */
.site-header-inner {
    max-width: var(--measure);
    margin: 0 auto;
}

.site-content,
.site-footer {
    max-width: calc(var(--measure) + 2 * var(--gutter));
    margin: 0 auto;
}

.site-content {
    padding: 0 var(--gutter);
}

.site-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
}

.site-title.has-logo a {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.6rem;
    max-width: 100%;
}

.site-logo {
    display: block;
    width: auto;
    max-width: min(12rem, 100%);
    height: auto;
    max-height: 3rem;
    padding: var(--logo-plate-pad);
    border-radius: var(--radius);
    background: var(--logo-plate);
}

.site-title a {
    color: inherit;
    text-decoration: none;
}

.site-description {
    margin: 0.25rem 0 0;
    color: var(--muted);
}

/* The menu and the search share a row; the search drops below when there's no room. */
.site-header-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-5);
    margin-top: var(--space-3);
}

.site-nav ul,
.site-footer ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-footer ul {
    margin-top: var(--space-3);
}

.site-nav a {
    color: inherit;
}

/*
 * The admin's "New article" and "New page" are forms, because starting a piece creates
 * it. Their buttons are dressed as the links beside them: every button style is undone
 * here, and each theme gives `.site-nav button.nav-link` what it gives `.site-nav a`.
 */
.site-nav .nav-form {
    display: inline;
    margin: 0;
}

.site-nav button.nav-link {
    display: inline;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    text-align: inherit;
    text-decoration: underline;
    text-transform: inherit;
    text-underline-offset: 0.15em;
    cursor: pointer;
}

/* Themes press and lift their buttons; a link does neither. */
.site-nav button.nav-link:is(:hover, :active) {
    box-shadow: none;
    transform: none;
}

.site-footer {
    margin-top: 3rem;
    padding: 1.5rem var(--gutter) 2rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.9rem;
}

.site-footer a {
    color: inherit;
}

.site-colophon {
    margin: 0.75rem 0 0;
}

article {
    hyphens: auto;
}

article img,
article video {
    max-width: 100%;
}

.articles {
    list-style: none;
    padding: 0;
}

.articles time,
article > p:has(> time) {
    color: var(--muted);
}

.summary-meta,
.article-meta {
    font-size: var(--text-sm);
}

.summary-meta {
    margin: 0 0 var(--space-2);
    color: var(--muted);
}

.summary-teaser {
    margin: 0;
}

/* The language mark is an abbreviation, not a link: no dotted line under it. */
.summary-meta abbr {
    text-decoration: none;
    font-size: 0.85em;
    letter-spacing: 0.05em;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin: var(--space-6) 0 0;
    font-size: var(--text-sm);
}

.tags-label {
    color: var(--muted);
}

.tags a {
    padding: 0.1em 0.6em;
    border: 1px solid var(--control-border);
    border-radius: var(--control-radius);
    color: var(--fg);
    text-decoration: none;
}

.tags a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.more {
    margin-top: var(--space-5);
}

.empty {
    margin: var(--space-6) 0;
    padding: var(--space-5) var(--space-4);
    border: 1px dashed var(--border);
    color: var(--muted);
    text-align: center;
}

/* On a site with nothing published yet, the admin's way to start. */
.first-article {
    margin: calc(-1 * var(--space-3)) 0 var(--space-6);
    text-align: center;
}

.first-article button {
    padding: 0.6em 1.4em;
    font-size: var(--text-md);
}

.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin: var(--space-6) 0 0;
    font-size: var(--text-sm);
}

.pager-count {
    margin: 0 auto;
    color: var(--muted);
}

.pager [rel='next'] {
    margin-left: auto;
}

/* Reading aids under an article (#88): previous and next by date, then related
   articles by shared tags. Themes restyle them through these classes. */
.reading-time {
    white-space: nowrap;
}

.article-nav {
    margin: var(--space-6) 0 0;
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
    font-size: var(--text-sm);
}

.article-nav ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

.article-nav-next {
    grid-column: 2;
    text-align: end;
}

.article-nav a {
    display: block;
    text-decoration: none;
}

.article-nav-label {
    display: block;
    color: var(--muted);
    font-size: var(--text-xs);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.article-nav-prev .article-nav-label::before {
    content: '← ';
    content: '← ' / '';
}

.article-nav-next .article-nav-label::after {
    content: ' →';
    content: ' →' / '';
}

.article-nav-title {
    display: block;
    font-family: var(--font-heading);
    font-size: var(--text-md);
    line-height: 1.3;
}

.article-nav a:hover .article-nav-title,
.article-nav a:focus-visible .article-nav-title {
    text-decoration: underline;
}

.article-nav time {
    display: block;
    margin-top: var(--space-1);
    color: var(--muted);
}

@media (max-width: 30rem) {
    .article-nav ul {
        grid-template-columns: minmax(0, 1fr);
    }

    .article-nav-next {
        grid-column: auto;
    }
}

.related {
    margin: var(--space-6) 0 0;
}

.related > h2 {
    margin: 0 0 var(--space-3);
    font-size: var(--text-lg);
}

.related-list {
    display: grid;
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

.related-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.related-text {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.related-title {
    font-family: var(--font-heading);
    font-size: var(--text-md);
    line-height: 1.3;
}

.related-meta {
    margin: var(--space-1) 0 0;
    color: var(--muted);
    font-size: var(--text-sm);
}

/* The listing thumbnail, smaller. Each theme treats it as it treats covers in its lists. */
.related .article-cover-thumb {
    flex: 0 0 5rem;
    float: none;
    width: 5rem;
    margin: 0;
}

.related .article-cover-thumb img {
    aspect-ratio: 4 / 3;
}

.teaser {
    font-style: italic;
}

figure.media-image {
    margin: 1.5rem 0;
}

figure.media-image img,
.media-gallery img,
video.media-loop {
    display: block;
    max-width: 100%;
    height: auto;
}

video.media-loop {
    cursor: pointer;
}

figure.media-video,
figure.media-audio {
    margin: 1.5rem 0;
}

figure.media-video video {
    display: block;
    width: 100%;
    height: auto;
}

figure.media-audio audio {
    display: block;
    width: 100%;
}

/* The site's player (player.js). Colours follow the text, so themes carry over. */
.audio-player {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 0.85rem;
}

.audio-play {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-fg);
    cursor: pointer;
}

.audio-play:hover {
    background: color-mix(in srgb, var(--accent) 86%, var(--fg));
}

.audio-play:active {
    transform: scale(0.96);
}

.audio-speed:hover {
    border-color: currentcolor;
}

.audio-play svg {
    width: 1.4rem;
    height: 1.4rem;
    fill: currentcolor;
}

.audio-wave {
    position: relative;
    flex: 1 1 10rem;
    min-width: 8rem;
    height: 3rem;
    cursor: pointer;
    touch-action: none;
}

.audio-wave:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.audio-wave svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.audio-bars {
    fill: currentcolor;
    opacity: 0.25;
}

.audio-played {
    fill: var(--accent);
    clip-path: inset(0 100% 0 0);
}

.audio-time {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.audio-speed {
    min-width: 3.2rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid color-mix(in srgb, currentcolor 35%, transparent);
    border-radius: 1rem;
    background: none;
    color: inherit;
    font: inherit;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.audio-player.is-broken .audio-play,
.audio-player.is-broken .audio-speed {
    display: none;
}

figure.media-video video {
    border-radius: var(--radius);
    background: #000;
}

figcaption {
    margin-top: var(--space-2);
    color: var(--muted);
    font-size: 0.9em;
    font-style: italic;
}

/*
 * Three to a row, two on a phone, and the last row always full: two leftovers share
 * it, a single one takes it whole as a wide picture.
 */
.media-gallery {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.media-gallery > * {
    grid-column: span 2;
}

.media-gallery > :nth-child(3n + 1):nth-last-child(2),
.media-gallery > :nth-child(3n + 1):nth-last-child(2) + * {
    grid-column: span 3;
}

.media-gallery > :nth-child(3n + 1):last-child {
    grid-column: span 6;
}

.media-gallery img,
.media-gallery video {
    width: 100%;
    height: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.media-gallery > :nth-child(3n + 1):last-child :is(img, video),
.media-gallery > video:nth-child(3n + 1):last-child {
    aspect-ratio: 21 / 9;
}

@media (max-width: 30rem) {
    .media-gallery > *,
    .media-gallery > :nth-child(3n + 1):nth-last-child(2),
    .media-gallery > :nth-child(3n + 1):nth-last-child(2) + * {
        grid-column: span 3;
    }

    .media-gallery > :nth-child(odd):last-child {
        grid-column: span 6;
    }

    .media-gallery > :nth-child(3n + 1):last-child:nth-child(even) {
        grid-column: span 3;
    }

    .media-gallery > :nth-child(3n + 1):last-child:nth-child(even) :is(img, video) {
        aspect-ratio: 4 / 3;
    }

    .media-gallery > :nth-child(odd):last-child :is(img, video) {
        aspect-ratio: 21 / 9;
    }
}

a.lightbox {
    display: block;
}

a.lightbox img {
    transition: opacity var(--motion-fast) var(--ease);
}

a.lightbox:hover img {
    opacity: 0.88;
}

.lightbox-dialog {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgb(0 0 0 / 92%);
}

.lightbox-dialog::backdrop {
    background: rgb(0 0 0 / 92%);
}

.lightbox-dialog[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-dialog img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.lightbox-dialog[open] {
    animation: lightbox-in var(--motion) var(--ease);
}

@keyframes lightbox-in {
    from {
        opacity: 0;
    }
}

.lightbox-dialog button {
    position: absolute;
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border: 0;
    border-radius: 50%;
    padding: 0 0 0.15em;
    background: rgb(0 0 0 / 60%);
    color: #fff;
    font-family: system-ui, sans-serif;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.lightbox-dialog button:hover {
    background: rgb(255 255 255 / 25%);
}

.lightbox-dialog :focus-visible {
    outline-color: #fff;
}

.lightbox-count {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    margin: 0;
    padding: 0.15rem 0.7rem;
    border-radius: 1rem;
    background: rgb(0 0 0 / 60%);
    color: #fff;
    font-family: system-ui, sans-serif;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    transform: translateX(-50%);
}

.lightbox-close {
    top: 0.5rem;
    right: 0.5rem;
}

.lightbox-previous {
    top: calc(50% - 1.5rem);
    left: 0.5rem;
}

.lightbox-next {
    top: calc(50% - 1.5rem);
    right: 0.5rem;
}

figure.article-cover {
    margin: 1rem 0 1.5rem;
}

figure.article-cover img,
.article-cover-thumb img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Beside the summary in listings. Themes (S9) will do more with it. */
.article-cover-thumb {
    float: right;
    width: 8rem;
    margin: 0 0 0.5rem 1rem;
}

.article-cover-thumb img {
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.articles > li {
    display: flow-root;
}

figure.media-file {
    display: grid;
    grid-template-columns: minmax(0, 28rem) auto;
    align-items: center;
    justify-content: start;
    gap: var(--space-2) var(--space-3);
    margin: 1.5rem 0;
}

figure.media-file figcaption {
    grid-column: 1 / -1;
    margin-top: 0;
}

.file-card {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 0.75rem;
    align-items: center;
    max-width: 28rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: inherit;
    text-decoration: none;
    transition: border-color var(--motion-fast) var(--ease), background-color var(--motion-fast) var(--ease);
}

.file-card:hover,
.file-card:focus-visible {
    border-color: var(--accent);
    background: var(--surface);
}

.file-card img,
.file-card .file-icon {
    grid-row: span 2;
    width: 4rem;
    height: auto;
}

.file-card .file-icon {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
}

.file-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.file-about {
    color: var(--muted);
    font-size: 0.875rem;
}

.file-download {
    padding: var(--control-pad-y) var(--control-pad-x);
    border: 1px solid var(--control-border);
    border-radius: var(--control-radius);
    color: var(--fg);
    font-size: var(--text-sm);
    text-decoration: none;
}

.file-download:hover {
    border-color: var(--fg);
}

.likes {
    margin: var(--space-5) 0 var(--space-4);
}

.likes > p {
    margin: 0;
}

.like-button {
    transition: background-color var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease), transform var(--motion-fast) var(--ease);
}

.like-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.like-button[aria-pressed='true']:hover {
    color: var(--accent-fg);
}

.like-button:active {
    transform: scale(0.96);
}

.like-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.like-button {
    padding: 0.35rem 0.9rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.like-button[aria-pressed='true'] {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-fg);
}

.like-admin {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px dashed currentColor;
    font-size: 0.875rem;
}

.like-admin p {
    flex: 1 1 100%;
    margin: 0;
}

.like-admin input {
    width: 8rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Comments. Indentation stops at five levels, three on a phone; deeper replies say whom they answer. */
.comments {
    margin: 2.5rem 0 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.comment-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.comment-list .comment-list {
    padding-left: 1.25rem;
    border-left: 2px solid var(--border);
}

.comment.depth-5 > .comment-replies > .comment-list {
    padding-left: 0;
    border-left: 0;
}

@media (max-width: 40rem) {
    .comment-list .comment-list {
        padding-left: 0.75rem;
    }

    .comment.depth-3 > .comment-replies > .comment-list,
    .comment.depth-4 > .comment-replies > .comment-list {
        padding-left: 0;
        border-left: 0;
    }
}

.comment-body {
    margin: 0.75rem 0;
}

.comment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.75rem;
    align-items: baseline;
    font-size: 0.9rem;
}

.comment-meta time,
.comment-reply-to,
.comment-flag {
    color: var(--muted);
}

.comment-flag {
    font-size: 0.8rem;
    font-style: italic;
}

.comment-text p {
    margin: 0.35rem 0;
}

.comment.is-held > .comment-body,
.comment.is-removed > .comment-body {
    /* Set apart by a dashed rule, not by fading: faded text falls below AA contrast. */
    padding-left: 0.75rem;
    border-left: 2px dashed var(--border);
}

.comment-removed {
    color: var(--muted);
    font-style: italic;
}

.comment.is-pinned > .comment-body {
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--accent);
    background: var(--surface);
}

.comment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.6rem;
    align-items: center;
    font-size: 0.85rem;
}

/* The admin's tools: one quiet row, so they don't shout over the comment. */
.comment-actions form {
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
}

.comment-actions button {
    border-color: transparent;
    background: none;
    color: var(--muted);
}

.comment-actions button:hover {
    border-color: var(--control-border);
    color: var(--fg);
}

.comment-actions form {
    display: inline;
}

.comment-actions button,
.comment-actions select {
    padding: 0.15em 0.5em;
    font-size: var(--text-xs);
}

/* Deleting an account asks for a tick first, in the same quiet row. */
.comment-actions .check {
    display: inline-flex;
    gap: 0.25rem;
    color: var(--muted);
    font-size: var(--text-xs);
}

.comment-replies > summary {
    color: var(--muted);
    font-size: 0.85rem;
    cursor: pointer;
}

.comment-form {
    display: grid;
    gap: 0.4rem;
    margin: 1rem 0;
}

.comment-form label {
    font-size: var(--text-sm);
    font-weight: 600;
}

.comment-form > a {
    justify-self: start;
    font-size: var(--text-sm);
}

.comment-meta {
    margin-bottom: 0.15rem;
}

.comment-form textarea {
    width: 100%;
    padding: 0.5rem;
    font-size: inherit;
}

.comment-form button {
    justify-self: start;
}

.comment-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.comment-error {
    margin: 0;
    font-weight: 700;
}

.comment-mode {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border: 1px dashed currentColor;
    font-size: 0.875rem;
}

.site-search {
    display: flex;
    gap: 0.35rem;
}

main .site-search {
    margin-top: 0.75rem;
}

.site-search input {
    min-width: 0;
    max-width: 14rem;
}

.lang-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
}

.lang-filter a {
    display: block;
    padding: 0.1em 0.6em;
    border: 1px solid transparent;
    border-radius: var(--control-radius);
    text-decoration: none;
}

.lang-filter a:hover {
    border-color: var(--control-border);
}

.lang-filter [aria-current] {
    border-color: var(--control-border);
    background: var(--surface);
    color: var(--fg);
    font-weight: 700;
}

.search-count {
    color: var(--muted);
    font-size: var(--text-sm);
}

.search-results {
    padding: 0;
    list-style: none;
}

.search-results > li {
    margin-bottom: 1.5rem;
}

.search-results h2 {
    margin-bottom: 0.25rem;
}

mark {
    padding: 0 0.1em;
    background: color-mix(in srgb, var(--accent) 25%, transparent);
    color: inherit;
}

/*
 * The sign-in and account pages: each concern in its own panel, fields under their
 * labels, and the buttons of one decision side by side.
 */
.panel {
    margin: var(--space-5) 0;
    padding: var(--space-4) var(--space-5) var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.panel > h2 {
    margin: 0 0 var(--space-3);
}

.panel > :last-child,
.panel form > :last-child {
    margin-bottom: 0;
}

/* The welcome: the one panel a new reader should notice. */
.panel-welcome {
    border-left: 4px solid var(--accent);
    background: var(--surface);
}

.panel-hint {
    margin-top: var(--space-3);
    color: var(--muted);
}

/* What can't be undone. */
.panel-danger {
    border-color: var(--danger);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    margin: var(--space-3) 0 0;
}

.field {
    margin: var(--space-3) 0;
}

.field label {
    display: grid;
    gap: var(--space-1);
    font-size: var(--text-sm);
    font-weight: 600;
}

.field input {
    width: 100%;
    max-width: 24rem;
    font-weight: 400;
}

.field input[inputmode='numeric'] {
    max-width: 8rem;
    letter-spacing: 0.15em;
}

.check {
    display: flex;
    gap: var(--space-2);
    align-items: baseline;
}

/* A form that asks for the password again sits apart from what it guards. */
.confirm-form {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px dashed var(--border);
}

.panel > .confirm-form:first-of-type:nth-child(2) {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.login-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.login-list > li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-2) 0;
    border-top: 1px solid var(--border);
}

.login-list > li:first-child {
    border-top: 0;
}

.login-name {
    font-weight: 600;
}

.login-id {
    color: var(--muted);
    font-size: var(--text-sm);
    font-weight: 400;
    overflow-wrap: anywhere;
}

.provider-list {
    display: grid;
    gap: var(--space-3);
    margin: var(--space-5) 0;
    padding: 0;
    list-style: none;
}

.provider-list > li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
}

.provider-list .button {
    min-width: 14rem;
    padding: 0.6em 1.1em;
    font-size: var(--text-md);
    text-align: center;
}

.provider-list small {
    color: var(--muted);
}

/*
 * Google's and Twitch's buttons, as their brand guidelines ask, and the same as on the
 * network's central login: Google's dark button with the "G" in Roboto Medium, and
 * Twitch purple with the white Glitch. They look the same in every theme and keep
 * their colours in forced-colours mode. The NetWork XXIII button is our own brand,
 * so it stays in the theme's style.
 *
 * The id inside :is() is never used. It only gives these rules an id's weight, so
 * they win over every theme's button styles, which load after this file.
 */
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    /* Roboto (Apache-2.0), latin subset from @fontsource/roboto 5.1.0. */
    src: url('fonts/roboto-500.woff2') format('woff2');
}

:is(.provider-button, #provider-button) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 40px;
    margin: 0;
    padding: 9px 12px;
    border: 1px solid;
    border-radius: 4px;
    box-shadow: none;
    font: 500 14px/20px 'Roboto', Arial, sans-serif;
    letter-spacing: 0.25px;
    text-align: center;
    text-decoration: none;
    text-shadow: none;
    text-transform: none;
    transform: none;
    forced-color-adjust: none;
}

:is(.provider-button, #provider-button)::before,
:is(.provider-button, #provider-button)::after {
    content: none;
}

:is(.provider-button, #provider-button) img {
    flex: none;
    width: 20px;
    height: 20px;
}

:is(.provider-button, #provider-button):is(:hover, :active) {
    box-shadow: none;
    transform: none;
}

:is(.provider-google, #provider-button) {
    border-color: #8e918f;
    background: #131314;
    color: #e3e3e3;
}

:is(.provider-google, #provider-button):is(:hover, :active) {
    border-color: #8e918f;
    background: #2a2a2b;
    color: #e3e3e3;
}

:is(.provider-twitch, #provider-button) {
    border-color: #9146ff;
    background: #9146ff;
    color: #fff;
}

:is(.provider-twitch, #provider-button):is(:hover, :active) {
    border-color: #772ce8;
    background: #772ce8;
    color: #fff;
}

.provider-list .provider-button {
    min-width: 14rem;
}

.error-page {
    padding: var(--space-7) 0;
}

.error-text {
    color: var(--muted);
}

.error-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-5);
}

/*
 * On paper: the article and nothing around it. Black on white whatever the theme,
 * with the addresses of links spelled out, since paper can't follow them.
 */
@media print {
    html:root {
        --bg: #fff;
        --fg: #000;
        --muted: #333;
        --accent: #000;
        --accent-fg: #fff;
        --border: #999;
        --surface: #fff;
        --header-bg: #fff;
        --header-fg: #000;
    }

    html body {
        display: block;
        min-height: 0;
        background: #fff;
        color: #000;
        font-size: 11pt;
        text-shadow: none;
    }

    body > small {
        display: none;
    }

    .skip-link,
    .admin-edit,
    .site-search,
    .site-nav,
    .site-footer nav,
    .lang-filter,
    .likes,
    .article-nav,
    .related,
    .comment-form,
    .comment-actions,
    .comment-mode,
    .comments > p:has(a[href^='/login']),
    .audio-player,
    video,
    audio,
    nav[aria-label='Pages'] {
        display: none;
    }

    .site-header,
    .site-header-inner,
    .site-content,
    .site-footer {
        max-width: none;
        padding-right: 0;
        padding-left: 0;
        border: 0;
        background: none;
        color: #000;
    }

    .site-header a,
    .site-footer a {
        color: #000;
    }

    article a[href^='http']::after {
        content: ' (' attr(href) ')';
        font-size: 0.85em;
        overflow-wrap: anywhere;
    }

    h1,
    h2,
    h3,
    h4 {
        break-after: avoid;
    }

    figure,
    pre,
    blockquote,
    table,
    .comment-body {
        break-inside: avoid;
    }

    table {
        display: table;
        overflow: visible;
    }

    .comment-replies > summary {
        display: none;
    }
}
