/* Colours (--sand, --sun, --scale, --ink, ...), --radius and theme artwork come from themes.css,
   generated from src/themes/themes.ts */

* { box-sizing: border-box; }

/* The hidden attribute must win over display rules like .load-more's */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  /* The theme's faint background tile (see themes.css) */
  background: var(--sand) var(--theme-pattern, none) repeat;
  color: var(--ink);
  line-height: 1.5;
}

a { color: var(--scale); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--ink-soft); }
.error { color: var(--danger); }

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  background: color-mix(in srgb, var(--sand) 90%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 1.3rem; color: var(--ink); display: inline-flex; align-items: center; gap: 0.4rem; }
/* The theme's lizard next to the name; the emoji is the fallback where images aren't drawn (forced colours) */
.brand::before { content: ''; width: 2.2rem; height: 2.2rem; background: var(--theme-mascot, none) center / contain no-repeat; }
.brand-emoji { display: none; }
@media (forced-colors: active) {
  .brand::before { display: none; }
  .brand-emoji { display: inline; }
}
#nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
#nav a {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: var(--ink);
}
#nav a.active, #nav a:hover { background: var(--sand-deep); text-decoration: none; }
/* Phones: Search, Bookmarks, Profile, Settings and the staff pages behind "More" (in the row elsewhere) */
.nav-more { display: contents; }
.nav-more-toggle { display: none; padding: 0.35rem 0.7rem; border: none; border-radius: 999px; background: none; color: var(--ink); font: inherit; cursor: pointer; }
.nav-more-toggle:hover, .nav-more-toggle[aria-expanded="true"], .nav-more-toggle:has(+ .nav-more a.active) { background: var(--sand-deep); }
/* An open report waiting behind it */
.nav-more-toggle:has(+ .nav-more .badge:not([hidden]))::after { content: ''; display: inline-block; width: 0.5rem; height: 0.5rem; margin-left: 0.3rem; border-radius: 50%; background: var(--sun); vertical-align: middle; }
@media (max-width: 37.5rem) {
  #nav { position: relative; gap: 0; }
  #nav a, .nav-more-toggle { padding: 0.35rem 0.45rem; }
  .nav-more-toggle { display: inline-block; }
  .nav-more { display: none; position: absolute; z-index: 15; right: 0; top: calc(100% + 0.3rem); min-width: 11rem; flex-direction: column; gap: 0.1rem; padding: 0.4rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 20px rgb(0 0 0 / 15%); }
  .nav-more-toggle[aria-expanded="true"] + .nav-more { display: flex; }
}
.badge {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--sun);
  color: #2b2118;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ---- Layout ---- */
main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1rem;
  /* Long handles and links ("Signed in as @a-very-long-name@...") wrap instead of widening the page */
  overflow-wrap: break-word;
}
.page-title { font-size: 1.4rem; margin: 0.5rem 0 1rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.narrow { max-width: 26rem; margin: 2rem auto; }
.intro { text-align: center; padding: 1.5rem 0; }
/* Daytime art is dimmed a little in dark mode (--hero-filter) so it doesn't glare */
.intro-art { aspect-ratio: 3 / 2; max-height: 22rem; margin: 0 auto 1rem; border-radius: var(--radius); background: var(--sand-deep) var(--theme-hero, none) center / cover no-repeat; filter: var(--hero-filter, none); }
/* Empty lists: the theme's lizard waiting patiently above the text */
.empty { text-align: center; padding: 1rem 0 0.5rem; }
.empty::before { content: ''; display: block; width: 9rem; height: 9rem; margin: 0 auto 0.5rem; background: var(--theme-empty, none) center / contain no-repeat; }
.intro h1 { font-size: 2.2rem; margin: 0; }
/* An empty home feed: first steps for a new account */
.welcome { text-align: left; padding: 1rem 1.25rem; }
.welcome .welcome-write { color: var(--scale); }
.welcome h2 { margin: 0 0 0.4rem; text-align: center; }
.welcome-steps { padding-left: 1.3rem; }
.welcome-steps > li { margin: 0.6rem 0; }
.welcome-people { margin: 0.2rem 0 0; }
.welcome-people li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0; }
.welcome-directory { display: inline; }
.welcome-directory:focus { outline: none; }
/* People in lists (the directory, suggestions) */
.person-row { display: flex; gap: 0.6rem; align-items: flex-start; }
.person-info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.person-bio { margin: 0.2rem 0 0; font-size: 0.9rem; }
.person-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.tag-info { margin-top: -0.5rem; }

/* ---- Buttons & forms ---- */
.button {
  display: inline-block;
  padding: 0.45rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.button:hover { border-color: var(--sun); text-decoration: none; }
.button.primary { background: var(--sun); border-color: var(--sun); color: var(--on-sun); }
.button.primary:hover { background: var(--sun-deep); color: var(--on-sun-deep); }
.button.danger { color: var(--danger); }
.button:disabled { opacity: 0.5; cursor: default; }
.link-button {
  border: none;
  background: none;
  padding: 0;
  color: var(--ink-soft);
  font: inherit;
  cursor: pointer;
}
.link-button:hover { color: var(--scale); text-decoration: underline; }
.link-button.danger:hover { color: var(--danger); }

.form label { display: block; margin-bottom: 0.9rem; font-weight: 600; }
.form small { display: block; font-weight: 400; }
/* Text-like fields fill their line under the label; checkboxes, radios and file pickers keep their
   own size next to their text (a radio stretched to the full width pushed its option onto a line
   of its own). :where() keeps this as weak as a plain "input" rule, so class rules still win. */
input:where(:not([type=checkbox], [type=radio], [type=file], [type=range], [type=color], [type=image])), textarea {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--sand);
  color: var(--ink);
  font: inherit;
  /* Typed text in normal weight, not the label's bold */
  font-weight: 400;
}
/* Native selects were tiny and unthemed next to the inputs */
select {
  max-width: 100%;
  margin: 0.25rem 0.25rem 0 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--sand);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}
/* Under its label, like the text inputs */
.form label > select { display: block; }
input[type=checkbox], input[type=radio], progress { accent-color: var(--scale); }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, .theme-option:has(input:focus-visible) {
  outline: 2px solid var(--scale);
  outline-offset: 1px;
}
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 1rem; }
#profile fieldset { min-inline-size: 0; }
#profile fieldset code { overflow-wrap: anywhere; }
.link-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.link-row input { margin: 0; }

/* ---- Avatar editor ---- */
.avatar-editor { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.avatar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; }
.avatar-actions small { flex-basis: 100%; }

/* ---- Composer ---- */
.composer {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 1rem;
}
.composer textarea { resize: vertical; min-height: 4.5rem; margin: 0; background: var(--card); border: none; }
.composer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }
.counter { margin-right: auto; }
.counter-low { color: var(--danger); font-weight: 600; }
.mention-suggestions {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  z-index: 5;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgb(0 0 0 / 15%);
}
.mention-suggestion {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.7rem;
  border: none;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mention-suggestion:hover, .mention-suggestion[aria-selected="true"] { background: var(--sand-deep); }
/* Long handles wrap instead of pushing the page sideways */
.mention-suggestion { flex-wrap: wrap; }
.mention-suggestion span { min-width: 0; overflow-wrap: anywhere; }

/* ---- Posts ---- */
.post {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
}
.post-deleted { opacity: 0.7; }
.post-header { display: flex; gap: 0.7rem; align-items: flex-start; }
.post-header a { color: inherit; }
.post-meta { min-width: 0; overflow-wrap: anywhere; }
.post-kind { color: var(--sun-deep); font-weight: 600; font-size: 0.9rem; }
.post-body { margin: 0.5rem 0; white-space: normal; overflow-wrap: anywhere; }
.post-body a, .profile-bio a { color: var(--scale); }
.post-body p { margin: 0 0 0.5rem; }
.post-body p:last-child { margin-bottom: 0; }
.post-body blockquote { margin: 0.4rem 0; padding-left: 0.8rem; border-left: 3px solid var(--line); }
.post-body pre { overflow-x: auto; white-space: pre-wrap; }
/* Mastodon-style shortened links: the scheme is hidden, long URLs end in an ellipsis */
.post-body .invisible { display: none; }
.post-body .ellipsis::after { content: '…'; }
.post-cw { margin: 0.5rem 0; }
.post-cw > summary { cursor: pointer; font-weight: 600; padding: 0.3rem 0.6rem; border-radius: 8px; background: var(--sand-deep); }
.post-cw[open] > summary { margin-bottom: 0.4rem; }
.post-visibility { cursor: help; }
.composer-cw { width: 100%; margin-bottom: 0.4rem; }
.composer-visibility, .composer-bar select { width: auto; margin: 0; }
.composer-bar [aria-pressed="true"] { background: var(--sand-deep); }
.pill { display: inline-block; margin-left: 0.4rem; padding: 0 0.5rem; border-radius: 999px; background: var(--sand-deep); font-size: 0.8rem; }
label.checkbox { display: flex; gap: 0.5rem; align-items: baseline; }
label.checkbox input { width: auto; flex: none; }
/* A link about a checkbox's choice, under it (in line with its text) */
.checkbox-note { margin: -0.6rem 0 0.9rem 1.6rem; }
.post-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.post-actions { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; align-items: center; font-size: 0.9rem; }
.post-actions a { color: var(--ink-soft); }
/* Tap targets (WCAG 2.5.8): a post's actions are at least 24 px everywhere (🔁 and 🔖 alone were
   18 px wide); on touch screens they, the reactions and other rows of actions are 44 px high, and
   checkboxes and radios 24 px, while a mouse keeps the compact row (the rules for touch screens
   are at the end of this file, so they win over the ones for each kind of row) */
.post-actions > button, .post-actions > a { display: inline-flex; align-items: center; justify-content: center; min-width: 1.5rem; min-height: 1.5rem; }

.object-card {
  display: grid;
  margin-top: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  color: var(--ink);
}
.object-card:hover { border-color: var(--sun); text-decoration: none; }
/* Thumbnails and link preview pictures: 16:9 (room kept while loading), cropped to fit */
.object-image { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--sand-deep); }
.object-title { padding: 0.5rem 0.75rem 0; font-weight: 700; }
.object-url { padding: 0 0.75rem 0.5rem; color: var(--ink-soft); font-size: 0.85rem; }

.reactions { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.reaction {
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--sand);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.reaction-empty { opacity: 0.55; }
.reaction-empty:hover { opacity: 1; }
.reaction-mine { border-color: var(--sun); background: color-mix(in srgb, var(--sun) 25%, var(--card)); opacity: 1; }
.reaction:disabled { cursor: default; }
.reaction-static { cursor: default; }
.reaction-count { margin-left: 0.25rem; font-size: 0.85rem; font-weight: 600; }

.load-more { display: block; margin: 1rem auto; }
/* "3 new posts" above Home and Explore: stays in view under the header while scrolling down */
.new-posts-bar { position: sticky; top: 4.5rem; z-index: 5; text-align: center; }
.new-posts { margin: 0 auto 0.75rem; box-shadow: 0 4px 14px rgb(0 0 0 / 15%); }
.post-list > .post { scroll-margin-top: 5rem; }

/* ---- Threads ---- */
.replies { margin-left: 1.25rem; padding-left: 0.75rem; border-left: 2px solid var(--line); }
.thread-root > .replies { margin-left: 0.5rem; }

/* ---- Avatars ---- */
.avatar { flex: none; border-radius: 50%; object-fit: cover; vertical-align: middle; }
.avatar-initial {
  display: inline-grid;
  place-items: center;
  background: var(--scale);
  color: var(--on-scale);
  font-weight: 700;
}
.avatar-sm { width: 1.6rem; height: 1.6rem; font-size: 0.8rem; }
.avatar-md { width: 2.6rem; height: 2.6rem; font-size: 1.1rem; }
.avatar-lg { width: 5rem; height: 5rem; font-size: 2rem; }

/* ---- Profile ---- */
.profile-banner { display: block; width: 100%; aspect-ratio: 3 / 1; object-fit: cover; border-radius: 0.75rem; background: var(--sand-deep); }
.profile-banner-empty { background: linear-gradient(120deg, var(--sand-deep), var(--sun)); opacity: 0.5; }
.profile-banner-preview, .header-editor .profile-banner-empty { max-width: 24rem; }
.profile-cover { margin-bottom: 0.75rem; }
.header-editor { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin: 0.75rem 0; }
.header-editor .profile-banner { flex: 1 1 14rem; }
.profile-header { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem; }
.profile-info { flex: 1; min-width: 12rem; }
.profile-info h1 { margin: 0; }
.profile-links { display: flex; flex-wrap: wrap; gap: 0.75rem; padding: 0; list-style: none; }
.verified-mark { color: var(--scale); font-weight: 600; }
.tag-chips, .featured-people-list { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; list-style: none; }
.tag-chips li { padding: 0.2rem 0.7rem; border-radius: 999px; background: var(--sand-deep); }
.featured-people-list li { display: flex; align-items: center; }
.featured-people-list a { color: var(--ink); }
.profile-note textarea { width: 100%; resize: vertical; margin-top: 0.5rem; }
.profile-note-actions { margin-top: 0.3rem; }
.choice-list { border: none; padding: 0; margin: 0 0 0.5rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: 0.5rem 0; }
.settings-tags li { display: inline-flex; align-items: center; gap: 0.2rem; }
.link-verified a { text-decoration-color: var(--scale); }
.profile-counts a { color: var(--ink); }

/* ---- Profile actions / moderation ---- */
.profile-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem; }
.profile-relation { font-size: 0.9rem; }
.report-list { margin: 0.5rem 0; padding-left: 1.1rem; }

/* ---- Badges ---- */
.section-title { font-size: 1rem; margin: 0 0 0.5rem; }
.badges { margin-bottom: 1rem; }
.badge-list { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0; list-style: none; }
.badge-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.9rem;
}
.badge-icon { font-size: 1.1rem; }
.badge-app { font-size: 0.8rem; }

/* ---- Lists ---- */
.user-list, .notification-list, .app-list { list-style: none; padding: 0; }
.user-list li, .notification-list li { padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.user-list a, .notification-list a { color: var(--ink); }
.notification.unread { font-weight: 600; }
/* Communities (Lemmy, Mbin, PieFed) */
.community-find { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.community-find input { flex: 1; min-width: 0; }
.community-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; }
.community-home-toggle { margin-left: auto; font-size: 0.9rem; white-space: nowrap; }
.community-post { margin-bottom: 1rem; }
.community-post > summary { list-style: none; display: inline-block; cursor: pointer; }
.community-post > summary::-webkit-details-marker { display: none; }
.community-post-form { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.community-post-form input, .community-post-form textarea { width: 100%; box-sizing: border-box; }
.community-about { margin-bottom: 1rem; }
.app-list > li { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.scope-list { margin: 0.25rem 0 0; padding-left: 1.1rem; font-size: 0.9rem; }

.consent-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.consent-buttons .button { white-space: nowrap; }

/* ---- Toasts ---- */
.toasts {
  position: fixed;
  bottom: 1rem;
  /* Edge to edge with a margin (centring with left: 50% made phone pages scroll sideways) */
  left: 1rem;
  right: 1rem;
  z-index: 20;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
/* For screen readers only */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  max-width: 100%;
  overflow-wrap: anywhere;
  pointer-events: auto;
  padding: 0.6rem 0.6rem 0.6rem 1rem;
  border-radius: 1.2rem;
  text-align: center;
  background: var(--ink);
  color: var(--sand);
  box-shadow: 0 6px 20px rgb(0 0 0 / 20%);
  transition: opacity 0.4s;
}
.toast-error { background: var(--danger); color: var(--on-danger); }
.toast-text { flex: 1; min-width: 0; }
.toast-close { flex: none; min-width: 1.5rem; min-height: 1.5rem; padding: 0; border: none; border-radius: 50%; background: none; color: inherit; font: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer; opacity: 0.8; }
.toast-close:hover { opacity: 1; background: rgb(255 255 255 / 15%); }
/* A server's answer at its form (form-errors.js) */
.form-error { margin: 0.5rem 0; font-weight: 600; }
.field-error, .form .field-error { display: block; margin-top: 0.25rem; font-weight: 600; }
[aria-invalid="true"] { border-color: var(--danger); }
.toast-hide { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

@media (max-width: 30rem) {
  .link-row { grid-template-columns: 1fr; }
  .replies { margin-left: 0.5rem; }
  /* Composer: the two pickers share a row instead of wrapping one by one */
  .composer-bar select { flex: 1 1 8rem; max-width: none; }
  /* Deep threads stop indenting after three levels (cards were 180px wide at level eight) */
  .replies .replies .replies .replies { margin-left: 0; padding-left: 0; border-left: none; }
}

/* ---- Admin ---- */
.tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.tab { display: inline-block; padding: 0.35rem 0.8rem; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); }
.tab-active { background: var(--sun); border-color: var(--sun); color: var(--on-sun); font-weight: 600; }
.admin-list { list-style: none; padding: 0; margin: 0; }
.admin-row { padding: 0.6rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.admin-actions { display: inline-flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-left: 0.6rem; }
.admin-actions select { width: auto; margin: 0; padding: 0.15rem 0.3rem; }
/* An account in Admin → Accounts: who, the facts, the actions, each its own line */
.admin-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.5rem; }
.admin-row-head .pill { margin-left: 0; }
.admin-row-actions { display: flex; margin: 0.3rem 0 0; gap: 0.3rem 0.9rem; }
.admin-row-actions:empty { display: none; }
.pill-danger { background: var(--danger); color: var(--on-danger); }
.secret-box { margin: 0.8rem 0; padding: 0.8rem; border: 2px dashed var(--sun); border-radius: var(--radius); background: var(--card); }
.secret-row { display: flex; gap: 0.5rem; }
.secret-row input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; }
.inline-fields { display: flex; flex-wrap: wrap; gap: 0.8rem; }
/* (min-width: a long option in a select shrinks with the field instead of widening the page) */
.inline-fields label { flex: 1 1 10rem; min-width: 0; }
.inline-fields select { width: 100%; min-width: 0; }
.small { font-size: 0.85rem; }
.form h3 { margin: 1rem 0 0.4rem; font-size: 1rem; }

/* ---- Media ---- */
.media-grid { display: grid; gap: 4px; margin: 0.5rem 0; border-radius: var(--radius); overflow: hidden; max-height: 32rem; }
.media-count-1 { grid-template-columns: 1fr; }
.media-count-2, .media-count-4 { grid-template-columns: 1fr 1fr; }
.media-count-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.media-count-3 .media-item:first-child { grid-row: span 2; }
.media-item { position: relative; display: block; background: var(--sand-deep); min-height: 6rem; }
.media-item img { display: block; width: 100%; height: 100%; max-height: 32rem; object-fit: cover; }
.media-count-1 .media-item img { object-fit: contain; height: auto; }
.media-alt-badge { position: absolute; left: 0.4rem; bottom: 0.4rem; padding: 0 0.3rem; border-radius: 4px; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 0.7rem; font-weight: 700; }
.media-sensitive { cursor: pointer; position: relative; }
.media-sensitive img { filter: blur(24px); }
.media-sensitive::after { content: 'Sensitive: click to show'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 600; text-shadow: 0 1px 3px #000; }
.composer-media { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.4rem 0; }
.composer-media-item { display: flex; flex-direction: column; gap: 0.25rem; width: 9rem; }
.composer-media-item img { width: 100%; height: 6rem; object-fit: cover; border-radius: 8px; }
.composer-media-item input { margin: 0; font-size: 0.85rem; }

/* ---- Search, pins ---- */
.search-form { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.search-form input { flex: 1; margin: 0; }
.tag-list { list-style: none; padding: 0; }
.tag-list li { padding: 0.25rem 0; }
.trending { margin-bottom: 1rem; }
.trending-tags { list-style: none; padding: 0; margin: 0 0 0.5rem; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; }
.trending-links { list-style: none; padding: 0; margin: 0 0 0.5rem; }
.trending-links li { padding: 0.2rem 0; }
.trending-posts > summary { cursor: pointer; font-weight: 600; margin-bottom: 0.5rem; }
.pinned-posts:not(:empty) { margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px dashed var(--line); }
.post-pinned { color: var(--sun-deep); }
.small-button { padding: 0.2rem 0.7rem; font-size: 0.85rem; margin: 0.3rem 0; }
.recovery-codes { font-family: ui-monospace, monospace; font-size: 1rem; line-height: 1.6; user-select: all; }
.totp-qr { display: block; width: 220px; height: 220px; margin: 0.5rem 0; image-rendering: pixelated; background: #fff; }
.post-boosted { margin: 0 0 0.3rem; font-size: 0.85rem; }
.post-boosted a { color: inherit; font-weight: 600; }
.link-button.boosted { color: var(--scale); font-weight: 700; }
.moved-notice { border-left: 4px solid var(--sun); }
.page-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.inline-form input[type=text] { flex: 1 1 12rem; min-width: 0; }
.composer-when { display: block; margin-bottom: 0.4rem; font-weight: 600; }
.composer-when .muted { font-weight: 400; }
.scheduled-list { list-style: none; padding: 0; }
.link-card-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.9rem; }
.composer-poll { display: grid; gap: 0.3rem; margin: 0.4rem 0; }
.poll { margin: 0.5rem 0; }
.poll-choice { display: block; margin: 0.2rem 0; }
.poll-result { position: relative; display: flex; align-items: center; gap: 0.4rem; margin: 0.25rem 0; }
/* The bars drawn in the theme's colours (the browsers' own were dark and looked full at 0%): an
   outlined track, filled as far as the share */
.poll-result .poll-bar { appearance: none; -webkit-appearance: none; flex: none; width: 6rem; height: 0.7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--sand-deep); overflow: hidden; color: var(--sun); }
.poll-bar::-webkit-progress-bar { background: var(--sand-deep); border-radius: 999px; }
.poll-bar::-webkit-progress-value { background: var(--sun); border-radius: 999px; }
.poll-bar::-moz-progress-bar { background: var(--sun); border-radius: 999px; }
@media (forced-colors: active) {
  .poll-result .poll-bar { border-color: CanvasText; }
  .poll-bar::-webkit-progress-value { background: Highlight; }
  .poll-bar::-moz-progress-bar { background: Highlight; }
}
.poll-pct { min-width: 2.6rem; text-align: right; font-variant-numeric: tabular-nums; }
.poll-mine { font-weight: 600; }
.quote-placeholder { font-size: 0.95rem; }
/* Threads: the start you can't see, and a reply whose parent you can't see */
.post-unavailable { font-style: italic; }
.thread-orphan { margin: 0.5rem 0 -0.25rem; font-size: 0.85rem; }
.quote-policy-select, .composer-quote-policy { max-width: 12rem; }
/* In a post's action row: as small as the actions around it */
.quote-policy-select { margin: 0; padding: 0.1rem 0.4rem; font-size: 0.85rem; }
.composer-uploading { margin: 0.3rem 0; font-size: 0.9rem; }
.composer-uploading:empty { margin: 0; }
.composer-hint { margin: 0.3rem 0; }
.quote-box { margin: 0.5rem 0; padding: 0.5rem 0.75rem; border-left: 3px solid var(--line); background: var(--sand); border-radius: 0 var(--radius) var(--radius) 0; }
.post-title { margin: 0.2rem 0 0.4rem; font-size: 1.05rem; }

/* ---- Appearance picker ---- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.6rem; margin: 0.5rem 0 1rem; }
.theme-option { display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.6rem; align-items: center; padding: 0.6rem 0.7rem; border: 2px solid var(--line); border-radius: var(--radius); background: var(--card); cursor: pointer; }
.theme-option:has(input:checked) { border-color: var(--scale); }
/* The card shows focus; the radio itself doesn't need a second ring */
.theme-option input { grid-row: span 3; margin: 0; accent-color: var(--scale); }
.theme-option input:focus-visible { outline: none; }
.theme-swatch { display: flex; align-items: center; gap: 0.25rem; }
.theme-mascot { width: 2rem; height: 2rem; margin-right: 0.2rem; object-fit: contain; }
.swatch-dot { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 1px solid var(--line); forced-color-adjust: none; }
@media (forced-colors: active) {
  .theme-option:has(input:checked) { border-color: Highlight; }
}
.theme-name { font-weight: 600; }
.theme-description { font-size: 0.85rem; }
.mode-choice { display: flex; align-items: center; gap: 0.6rem; }
.mode-choice select { padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: 10px; background: var(--sand); color: var(--ink); font: inherit; }

/* ---- Settings: a page per group, its tabs above; the sticky header mustn't cover a section's title ---- */
.settings-tabs { margin-bottom: 1rem; }
main .card { scroll-margin-top: 5rem; }
/* Phones: the header with its two or three rows of links scrolls away instead of covering a
   fifth of the screen all the time */
@media (max-width: 40rem) {
  /* (relative, not static: its z-index keeps the "More" menu above the page) */
  .site-header { position: relative; }
  main .card, .post-list > .post { scroll-margin-top: 1rem; }
  .new-posts-bar { top: 0.5rem; }
}
/* Wide screens: indentation stops after six levels */
.replies .replies .replies .replies .replies .replies .replies { margin-left: 0; padding-left: 0; border-left: none; }

/* Notifications: the post's first words, lighter than the sentence around them */
.notification-excerpt { font-weight: 400; overflow-wrap: anywhere; }
/* The reply a link pointed to (/p/root#reply), so it can be found in a long thread */
.thread-target > .post { border-color: var(--sun); box-shadow: 0 0 0 2px var(--sun); }
.thread-target > .post:focus { outline: none; }

/* "Skip to content": off screen until it has the keyboard focus */
.skip-link { position: absolute; left: 0.5rem; top: -3rem; z-index: 30; padding: 0.5rem 1rem; border-radius: 999px; background: var(--sun); color: var(--on-sun); font-weight: 600; }
.skip-link:focus { top: 0.5rem; }
main:focus { outline: none; }
/* A new page's heading takes the focus (app.js): read out, not ringed */
h1[tabindex="-1"]:focus { outline: none; }

/* Dialogs of our own (dialog.js): a card over a dimmed page */
.dialog { width: min(32rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; color: var(--ink); margin: auto; }
.dialog::backdrop { background: rgb(0 0 0 / 0.45); }
.dialog h2 { margin-top: 0; }
.dialog textarea { width: 100%; resize: vertical; }
.dialog-count { display: block; text-align: right; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
/* A post's images (dialog.js showImages): as large as the window allows, the description under it */
.lightbox { width: min(64rem, calc(100vw - 2rem)); padding: 0.75rem; }
.lightbox::backdrop { background: rgb(0 0 0 / 0.8); }
.lightbox figure { margin: 0; }
.lightbox-image { display: block; max-width: 100%; max-height: calc(100vh - 11rem); margin: 0 auto; object-fit: contain; }
.lightbox-caption { margin: 0.5rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.lightbox-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem 0.75rem; margin-top: 0.5rem; }
.lightbox-count { margin-right: auto; }

/* ---- Instance pages (About, Rules, Terms, Privacy, ...) and the footer linking them ---- */
.site-footer { max-width: 42rem; margin: 1rem auto 2rem; padding: 1rem 1rem 0; border-top: 1px solid var(--line); font-size: 0.9rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; justify-content: center; }
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--scale); }
.page-lead { font-size: 1.1rem; }
.page-body { overflow-wrap: break-word; }
.page-body h2 { font-size: 1.2rem; margin: 1.4rem 0 0.4rem; }
.page-body h3 { font-size: 1.05rem; margin: 1.2rem 0 0.3rem; }
.page-body h4 { font-size: 1rem; margin: 1rem 0 0.3rem; }
.page-body li { margin: 0.25rem 0; }
.page-body blockquote { margin: 0.6rem 0; padding-left: 0.8rem; border-left: 3px solid var(--line); }
.page-body pre { overflow-x: auto; padding: 0.6rem 0.8rem; border-radius: 8px; background: var(--sand-deep); }
.page-body code { font-family: ui-monospace, monospace; font-size: 0.92em; }
.page-body hr { border: none; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.page-updated { margin-top: 1.5rem; font-size: 0.9rem; }
.rules-list { padding-left: 1.6rem; }
.rules-list > li { margin: 0.5rem 0; }
.rule-hint { display: block; white-space: pre-line; font-size: 0.95rem; }
.contact-list { padding-left: 1.2rem; }
.draft-banner { margin: -0.25rem 0 1rem; padding: 0.7rem 0.9rem; border: 2px dashed var(--sun-deep); border-radius: var(--radius); background: var(--sand-deep); }
.draft-banner p { margin: 0.3rem 0 0; }
/* Sign-up: the rules and the box to tick */
.agreement-field { margin: 0.5rem 0 1rem; }
.agreement-rules-title { margin: 0; font-weight: 600; }
.agreement-field .rules-list { margin: 0.3rem 0 0.8rem; }
.agreement-field label.checkbox { font-weight: 400; }
.agreement-field label.checkbox input { flex: none; }

/* ---- Admin → Instance: the page editor with its preview, rules, history ---- */
.page-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; align-items: start; }
.page-editor-grid textarea { min-height: 24rem; resize: vertical; font-family: ui-monospace, monospace; font-size: 0.9rem; line-height: 1.45; }
.page-preview { min-height: 24rem; max-height: 40rem; overflow: auto; margin-top: 0.25rem; padding: 0.6rem 0.8rem; border: 1px dashed var(--line); border-radius: 10px; background: var(--card); font-weight: 400; }
.page-preview > :first-child { margin-top: 0; }
@media (max-width: 44rem) {
  .page-editor-grid { grid-template-columns: 1fr; }
  .page-editor-grid textarea, .page-preview { min-height: 14rem; }
}
.markdown-help { font-size: 0.85rem; }
.markdown-help code { font-family: ui-monospace, monospace; }
.rule-row { display: grid; grid-template-columns: auto 1fr auto; gap: 0.3rem 0.6rem; align-items: start; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.rule-row .rule-number { padding-top: 0.6rem; font-weight: 700; }
.rule-row input, .rule-row textarea { margin: 0; }
.rule-row textarea { margin-top: 0.3rem; resize: vertical; }
.rule-row-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; padding-top: 0.35rem; }
.version-view { margin-top: 0.6rem; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--sand); }
/* The editor's heading takes the focus when a page is opened: read out, not ringed */
h2[tabindex="-1"]:focus { outline: none; }
/* ---- Installed app (ADR 0010): offline and "new version" notices, push settings ---- */
.app-banners { position: sticky; top: 0; z-index: 9; }
.app-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--sand-deep);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.app-banner .button { margin: 0; }
.notice { border-left: 4px solid var(--sun); padding-left: 0.75rem; }
.push-details { display: grid; gap: 0.35rem; padding: 0.75rem 1rem; }
.push-details[hidden] { display: none; }
.push-status:empty { display: none; }
/* ---- Sign-up and account safety (ADR 0011) ---- */
/* "Confirm your email address" above every page until it is */
.account-banner { max-width: 44rem; margin: 0.75rem auto 0; padding: 0.6rem 0.9rem; border: 2px solid var(--sun); border-radius: var(--radius); background: var(--card); }
.notice { padding: 0.5rem 0.75rem; border-left: 4px solid var(--sun); background: var(--sand-deep); border-radius: 0 var(--radius) var(--radius) 0; }
/* The sign-up form's field for bots: off-screen, out of the tab order and away from screen readers */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.password-hint { display: block; }
.password-weak { color: var(--danger); }
.password-ok { color: var(--ink-soft); }
.password-strong { color: var(--scale); }
.security-log { list-style: none; padding: 0; margin: 0.4rem 0; }
.security-log li { padding: 0.25rem 0; border-bottom: 1px solid var(--line); }
.admin-detail { flex-basis: 100%; margin: 0.5rem 0; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sand); }
.signup-reason { flex-basis: 100%; margin: 0.4rem 0; padding-left: 0.8rem; border-left: 3px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- Reports, moderation and decisions (ADR 0012) ---- */
/* A choice among several (report categories, a decision): the radio before its label */
label.choice { display: flex; flex-wrap: wrap; gap: 0 0.5rem; align-items: baseline; margin-bottom: 0.4rem; font-weight: 400; }
label.choice input { width: auto; margin: 0; }
/* The text beside the radio wraps there, instead of the whole text dropping under it */
label.choice > span { flex: 1 1 0; min-width: 0; }
label.choice small { flex-basis: 100%; padding-left: 1.5rem; }
.notice-danger { border-left: 4px solid var(--danger); }
.report-target { margin-top: -0.5rem; }
.mod-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.mod-account { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin-top: 0; }
/* Illegal content comes first and stands out; child sexual abuse material most of all */
.mod-illegal { border-left: 4px solid var(--sun-deep); }
.mod-csam { border-left: 6px solid var(--danger); }
.mod-warning { margin-top: 0; font-weight: 600; color: var(--danger); }
/* Several cases about one account, in one card */
.mod-group .mod-nested { margin: 0.75rem 0 0; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.mod-group .mod-nested.mod-illegal, .mod-group .mod-nested.mod-csam { padding-left: 0.6rem; }
.mod-decide { border-top: 1px solid var(--line); margin-top: 0.75rem; padding-top: 0.75rem; }
.report-reason { white-space: pre-wrap; }
.decision-facts dt { font-weight: 600; margin-top: 0.6rem; }
.decision-facts dd { margin: 0.1rem 0 0; }
.decision-statement, .decision-quote { white-space: pre-wrap; }
.decision-quote { margin: 0.4rem 0 0.8rem; padding: 0.4rem 0.8rem; border-left: 3px solid var(--line); }
.storage-line meter { width: 8rem; vertical-align: middle; }
.storage-line small { display: block; }
.table-scroll { overflow-x: auto; }
.transparency-table { border-collapse: collapse; font-size: 0.85rem; }
.transparency-table th, .transparency-table td { padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.transparency-table th[scope=row] { text-align: left; font-weight: 400; }
.evidence-hashes { flex-basis: 100%; font-size: 0.8rem; overflow-wrap: anywhere; }
/* Edit history (the "edited" label on a post) */
.post-edited { font-size: inherit; color: inherit; text-decoration: underline dotted; }
.history-list { list-style: none; padding: 0; margin: 0; }
.history-version { padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.history-version:last-child { border-bottom: none; }
.history-when { margin: 0 0 0.3rem; font-size: 0.85rem; }
.history-cw { font-weight: 600; margin: 0.2rem 0; }
.history-media, .history-poll { font-size: 0.85rem; padding-left: 1.2rem; }

/* ---- Direct messages (ADR 0016) ---- */
.conversation-list { list-style: none; padding: 0; margin: 0; }
.conversation > a { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.conversation-avatars { display: inline-flex; flex: none; }
.conversation-avatars .avatar + .avatar { margin-left: -0.6rem; box-shadow: 0 0 0 2px var(--card); }
.conversation-summary { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.conversation-excerpt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation.unread .conversation-summary strong::before { content: "● "; color: var(--sun); }
.conversation.unread .conversation-excerpt { color: var(--ink); font-weight: 600; }
.conversation-head { display: flex; align-items: center; gap: 0.8rem; }
.conversation-head .page-title { margin-bottom: 0; }
.conversation-head p { margin: 0.2rem 0 0; overflow-wrap: anywhere; }
.conversation-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.8rem 0 1rem; }
.conversation-messages { margin-bottom: 1rem; }
.report-messages { border: none; padding: 0; margin: 0 0 0.8rem; }
.report-messages label.choice { overflow-wrap: anywhere; }

/* ---- Touch screens: bigger targets (see .post-actions above) ---- */
@media (pointer: coarse) {
  .post-actions { gap: 0 0.3rem; }
  .post-actions > button, .post-actions > a { min-width: 2.75rem; min-height: 2.75rem; padding: 0 0.3rem; }
  .reaction { min-width: 2.75rem; min-height: 2.75rem; }
  .profile-actions .link-button, .admin-actions .link-button, .person-actions .link-button { min-height: 2.75rem; padding: 0 0.3rem; }
  input[type=checkbox], input[type=radio], label input[type=checkbox], label input[type=radio] { width: 1.5rem; height: 1.5rem; margin: 0; flex: none; }
  label.checkbox, label.choice { align-items: center; }
  label.choice small { padding-left: 2rem; }
  .poll-choice { display: flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; }
}

/* ---- Operating Bask (ADR 0019): the admin dashboard, Servers, announcements ---- */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.dash-tile { margin: 0; }
.dash-title { font-size: 0.95rem; margin: 0 0 0.3rem; color: var(--ink-soft); }
.dash-figure { font-size: 1.6rem; font-weight: 700; margin: 0 0 0.3rem; overflow-wrap: anywhere; }
.dash-line { margin: 0.15rem 0; font-size: 0.9rem; overflow-wrap: anywhere; }
.dash-status { font-weight: 600; }
.dash-status-ok { color: var(--scale-deep); }
.dash-status-warn { color: var(--ink); }
.dash-status-bad { color: var(--danger); }
.dash-chart { display: block; width: 100%; height: auto; max-height: 14rem; }
.dash-chart .dash-gridline { fill: none; stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.dash-chart .dash-axis { stroke: var(--line); stroke-width: 1; }
.dash-chart .dash-tick { fill: var(--ink-soft); font-size: 12px; }
.dash-chart .dash-hit { fill: transparent; }
.dash-chart .dash-local { fill: var(--scale); }
.dash-chart .dash-remote { fill: var(--sun-deep); }
.dash-chart .dash-day:hover .dash-hit, .dash-chart .dash-day:focus .dash-hit { fill: var(--sand-deep); }
.dash-chart .dash-day:focus { outline: none; }
.dash-chart .dash-day:focus-visible .dash-hit { stroke: var(--ink); stroke-width: 1; }
.dash-legend { margin: 0 0 0.4rem; font-size: 0.9rem; }
.dash-key { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 3px; vertical-align: -0.1rem; }
.dash-key-local { background: var(--scale); }
.dash-key-remote { background: var(--sun-deep); margin-left: 0.6rem; }
.dash-table { margin-top: 0.5rem; }
.servers-table th button.link-button { font-weight: 600; white-space: nowrap; }
.servers-table th[aria-sort] button.link-button { text-decoration: underline; }
.servers-table tbody th { text-align: left; }
.server-detail .admin-detail { margin: 0.4rem 0 1rem; }
.server-detail .consent-buttons { flex-wrap: wrap; }
.servers-block select { max-width: 100%; }
.server-facts { margin: 0.4rem 0; padding-left: 1.2rem; }
.server-facts li { margin: 0.2rem 0; }
.pill-quiet { opacity: 0.75; }
.page-preview.announcement-preview { min-height: 4rem; max-height: 20rem; }
.servers-filters label > select { display: block; width: 100%; margin-top: 0.25rem; }
.announcement-text { margin: 0.4rem 0; }
.announcements { max-width: 44rem; width: calc(100% - 2rem); margin: 0.75rem auto 0; display: grid; gap: 0.5rem; }
.announcement-banner { padding: 0.6rem 0.9rem; border: 2px solid var(--scale); border-radius: var(--radius); background: var(--card); }
.announcement-head { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: baseline; }
.announcement-dismiss { margin-left: auto; }
.announcement-banner .announcement-text p { margin: 0.3rem 0; }
.oidc-button { width: 100%; text-align: center; }
.auth-divider { text-align: center; margin: 0.9rem 0; font-size: 0.9rem; }
