/* One stylesheet; the only requests it makes are for this site's own font files in /fonts.
   Look: a reading room at night. Warm charcoal surfaces, ivory text, pale steel links, and one straw-gold accent kept
   for what is the reader's or current (their vote, the section they are in, an unread reply, the comment they were
   sent to). Titles and everything meant to be read are set in Literata, a serif; small interface text uses the
   device's own sans. Dark is the designed look; a device that asks for light gets the paper version of the same thing.
   Colours live only in the two theme blocks below; test/styles.test.ts checks every pair the rules draw. */

:root {
  color-scheme: light dark;
  --bg: #f5f2ec;
  --bg-deep: #ebe7de;       /* the header and footer bands */
  --surface: #fffdf9;       /* inputs, panels, chips, tables */
  --text: #26221d;
  --muted: #5f584e;
  --line: #ddd7cc;          /* dividers: decorative */
  --line-strong: #a79f92;   /* edges of things named by their own text: decorative */
  --control-border: #7d7568; /* edges of inputs and neutral buttons: 3:1 against what they sit on */
  --link: #1f4f8a;
  --link-visited: #6a3f93;
  --mark: #edc55c;          /* the accent as a fill */
  --mark-text: #2a2006;     /* text on the fill */
  --mark-soft: #f7eac4;     /* tint for a notice, an unread reply, a targeted comment */
  --accent-text: #7a5200;   /* the accent as a line: the current section or tab, the pressed vote's edge */
  --danger: #a12a1e;
  --danger-soft: #fbebe7;   /* tint behind errors and the account-deletion area */
  --focus: #1f4f8a;
  --button-bg: #26221d;
  --button-text: #fffdf9;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1e1b18;
    --bg-deep: #171512;
    --surface: #282420;
    --text: #ece6da;
    --muted: #a69e92;
    --line: #38332d;
    --line-strong: #5a534a;
    --control-border: #857d72;
    --link: #b3c9e6;
    --link-visited: #cdb7e3;
    --mark: #e7c26a;
    --mark-text: #2a2006;
    --mark-soft: #3a311c;
    --accent-text: #e7c26a;
    --danger: #f2a093;
    --danger-soft: #35211e;
    --focus: #f0cf80;
    --button-bg: #ece6da;
    --button-text: #1e1b18;
  }
}

/* ---- Typeface ---- */

/* Literata (SIL Open Font Licence; the licence text is beside the files). Variable weight, latin subset. Text shows in
   the fallback serif at once and changes when the file arrives. */
@font-face {
  font-family: "Literata";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("/fonts/literata-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Literata";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("/fonts/literata-latin-wght-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- Base ---- */

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

/* Shape and type: the same in both themes, so they sit outside the theme blocks.
   --serif is for titles and for anything read at length; --font is for the interface (menus, meta lines, buttons,
   form fields, tables); --mono is for code only. */
html {
  --radius: 8px;
  --radius-small: 4px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Literata", Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* The page is a column: header band, content, footer band. On a short page the footer still sits at the bottom. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
}

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.75rem 1rem 4rem;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 600;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(1.625rem, 1.3rem + 1.6vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0.25rem 0 1.1rem;
}

h2 {
  font-size: 1.3125rem;
  line-height: 1.25;
  margin: 2.25rem 0 0.75rem;
}

h3 {
  font-size: 1.0625rem;
  line-height: 1.3;
  margin: 1.5rem 0 0.5rem;
}

p {
  margin: 0 0 0.9rem;
}

a {
  color: var(--link);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.12em;
}

/* :where() keeps this at the weight of `a`, so every link that sets its own colour (sections, footer, meta lines,
   tabs) keeps it once visited; only plain links change. */
a:where(:visited) {
  color: var(--link-visited);
}

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

/* Main takes focus when the skip link is followed: a bar across its top edge, not a ring round the whole page. */
main:focus-visible {
  outline: none;
  box-shadow: inset 0 3px 0 var(--focus);
}

::selection {
  background: var(--mark);
  color: var(--mark-text);
}

small {
  font-size: 0.8125rem;
  color: var(--muted);
}

hr {
  height: 0;
  margin: 1.75rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* ---- Header ---- */

/* A band across the whole window; its padding keeps what is inside it on the same column as the page below
   (46rem less the page's 1rem gutters). Three groups: the name; the sections with the Submit button at their far end;
   the member's own things (Replies and a menu under their name). On a wide window they are one row. On a narrower
   one the sections and Submit take a second row of their own. */
body > header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 1.5rem;
  padding: 0 max(1rem, calc(50% - 22rem));
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line);
}

/* The name comes from a setting, so the design gives it only a typeface. Beside it sits the site's mark, the same
   drawing as the favicon: three dots in a row and one that stepped out, on the gold tile. */
.site-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.3125rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding-block: 0.65rem;
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}

/* As tall as the name's whole line (about one and a half times its tall letters), so the mark reads as a logo beside
   the name and the band keeps its height. A line's middle sits above the middle of its letters, which hang below
   it; the small drop puts the mark's middle on the letters' own (measured: between the middle of the capitals and
   the middle of the small letters). */
.site-mark {
  flex: none;
  position: relative;
  top: 0.09em;
  width: 1.3em;
  height: 1.3em;
}

.site-mark-tile {
  fill: var(--mark);
}

/* The dots are the colour of text on the gold fill; the three in the row are faded so the one apart stands out. */
.site-mark-row,
.site-mark-solo {
  fill: var(--mark-text);
}

.site-mark-row {
  fill-opacity: 0.35;
}

.header-main {
  order: 1;
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

/* The section links are as tall as their row, so the current one's gold edge stands on the band's lower edge. */
body > header nav {
  align-self: stretch;
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  font-size: 0.9375rem;
}

body > header nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  min-height: 2.5rem;
  color: var(--muted);
  text-decoration: none;
}

body > header nav a:hover {
  color: var(--text);
}

/* The section the page belongs to: full-strength text and a gold edge along its foot, on the band's own edge. */
body > header nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent-text);
}

/* Submit and Sign in are the header's buttons, drawn alike: a small outlined control. Each sits at the far end of
   its row. */
.header-submit,
a.account {
  flex: none;
  margin-left: auto;
  min-height: 1.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  padding: 0.25rem 0.8rem;
  color: var(--text);
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  text-decoration: none;
}

.header-submit:hover,
a.account:hover {
  border-color: var(--text);
}

/* On the Submit page the button is marked as the current section is: by the gold edge. */
.header-submit[aria-current="page"] {
  border-color: var(--accent-text);
}

/* A member's own things: their name, which opens a menu. */
.account-bar {
  margin-left: auto;
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 0.875rem;
}

.account-menu {
  position: relative;
  min-width: 0;
}

/* The name, with a small downward mark to say it opens. A long name is cut short with an ellipsis, so it never
   pushes the header onto another line. */
.account-menu > summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 11rem;
  min-height: 1.75rem;
  list-style: none;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.account-menu > summary::-webkit-details-marker {
  display: none;
}

.account-menu > summary::after {
  content: "";
  flex: none;
  border: 0.3em solid transparent;
  border-top-color: currentColor;
  border-bottom-width: 0;
}

.account-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Unread replies: their count on the gold fill, beside the name, so it shows while the menu is shut. */
.account-unread {
  flex: none;
  min-width: 1.25rem;
  padding: 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--mark-text);
  background: var(--mark);
  border-radius: 999px;
}

/* The open menu hangs from the name's right end, over the page. */
.account-menu-items {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 10rem;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

/* Every entry is drawn the same, whether it is a link or the Sign out button. */
.account-menu-items a,
.account-menu-items button {
  display: block;
  width: 100%;
  padding: 0.45rem 0.65rem;
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: var(--radius-small);
  text-decoration: none;
  cursor: pointer;
}

.account-menu-items a:hover,
.account-menu-items button:hover {
  background: var(--bg);
}

.account-menu-items a[aria-current="page"] {
  font-weight: 600;
}

/* Room for everything on one row: the sections move up beside the name, and the band's height is theirs. */
@media (min-width: 48rem) {
  .header-main {
    order: 0;
    flex: 1 1 auto;
  }

  body > header nav a {
    min-height: 3.4rem;
  }

  .account-bar,
  a.account {
    margin-left: 0;
  }
}

/* ---- Page head, Hot / New switch, pagination ---- */

/* A feed's heading with its sort switch at the far end of the same line. */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  margin: 0.25rem 0 1.1rem;
}

.page-head h1 {
  margin: 0;
}

/* Hot / New on a feed and Posts / Comments on a profile: a row of words, the current one marked as the current
   section is in the header. */
.sort-switch,
.profile-tabs {
  display: flex;
  gap: 1.25rem;
  margin: 0;
  font-size: 0.9375rem;
}

.sort-switch a,
.profile-tabs a {
  padding: 0.3rem 0;
  color: var(--muted);
  text-decoration: none;
}

.sort-switch a:hover,
.profile-tabs a:hover {
  color: var(--text);
}

/* The current tab: full-strength text and a gold edge along its foot (the edge is what reaches 3:1). */
.sort-switch a[aria-current="page"],
.profile-tabs a[aria-current="page"],
.admin-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent-text);
}

.pagination {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.75rem;
}

/* Previous and Next are controls, not reading links: they keep their colour once visited. */
.pagination a {
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  text-decoration: none;
}

.pagination a:hover {
  border-color: var(--text);
}

.pagination a[rel="next"] {
  margin-left: auto;
}

/* ---- Feed ---- */

/* Set like a contents page: the count hangs in the left margin as a figure, the title is the line you read. */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.post-row {
  position: relative;
  min-height: 4.6rem;
  padding: 0.9rem 0 0.9rem 4.25rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

/* The count sits in the left gutter of the row; the title flows beside it.
   The upvote button and the plain points text take the same slot. Only this rule sets their width. */
.post-row > .vote,
.post-row > .post-points {
  position: absolute;
  left: 0;
  top: 0.95rem;
  width: 3.25rem;
}

/* Signed out, or on your own post, the count is not a control: it keeps the slot but has no edge to press.
   "18 points" is one piece of text. Word spacing as wide as the slot puts the number and the word on separate lines,
   and ::first-line then sets the number as a figure. */
.post-row > .post-points {
  display: block;
  padding: 0.35rem 0 0.45rem;
  border: 1px solid transparent;
  font-size: 0.75rem;
  line-height: 1.25;
  text-align: center;
  word-spacing: 3.25rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.post-row > .post-points::first-line {
  font-family: var(--serif);
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
}

/* A member who can vote gets a button in the slot: the arrow over the count, the count set as the same figure. */
.post-row > .vote button {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  width: 100%;
  padding: 0.45rem 0 0.3rem;
  border-radius: var(--radius);
}

.post-row > .vote .vote-arrow {
  width: 1rem;
  height: 1rem;
}

.post-row > .vote .vote-count {
  font-family: var(--serif);
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.2;
}

.post-row .post-title {
  padding-block: 0.15rem;
  font-family: var(--serif);
  font-size: 1.1875rem;
  font-weight: 500;
  line-height: 1.32;
  color: var(--text);
  text-decoration: none;
}

.post-row .post-title:hover {
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
}

.post-row .post-title:visited {
  color: var(--muted);
}

/* What kind of post it is, and a Show post's stage: small labels. The type is filled; the stage is outlined. */
.post-type,
.post-stage {
  display: inline-block;
  font-size: 0.75rem;
  line-height: 1.5;
  padding: 0 0.45rem;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
  vertical-align: 0.14em;
}

.post-stage {
  background: transparent;
  border-color: var(--line-strong);
}


.post-host {
  font-size: 0.8125rem;
  color: var(--muted);
}

.post-meta {
  margin: 0.3rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* In the feed the line under a title is a row of pieces with even gaps: the kind, the site a link goes to, the author,
   the age, the comments. On a narrow screen it wraps between pieces; a piece breaks only if it is longer than the
   line (a very long site name). */
.post-row .post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0.6rem;
  margin-top: 0.2rem;
}

.post-meta a {
  color: var(--muted);
  text-decoration-color: var(--line-strong);
}

.post-meta a:hover {
  color: var(--text);
  text-decoration-color: currentColor;
}

/* Small links on meta lines and in lists: vertical padding grows the tap area to 24 px. On a link inside a line of
   text it does not move the text; where the link is itself a flex item it makes the row a little taller. */
.post-meta a,
.comment-meta a,
.profile-links a,
.admin-counts a,
.admin-table a {
  padding-block: 0.3rem;
}

/* A member's name is marked by its weight, not by an underline. */
.post-author,
.comment-author {
  color: var(--text);
  font-weight: 600;
}

.post-author a,
.comment-author a {
  color: inherit;
  text-decoration: none;
}

.post-author a:hover,
.comment-author a:hover {
  text-decoration: underline;
}


/* ---- Vote button ---- */

.vote {
  display: inline-block;
  margin: 0;
}

/* An upward arrow and the count beside it. At least 32 by 32 px wherever it appears, so it is easy to hit on a phone. */
.vote button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 2rem;
  min-height: 2rem;
  font: inherit;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  padding: 0.1rem 0.7rem 0.1rem 0.6rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  cursor: pointer;
}

/* The arrow is drawn with a rounded outline in its own colour, so its corners are soft at this size. */
.vote-arrow {
  flex: none;
  width: 0.75rem;
  height: 0.75rem;
  fill: var(--muted);
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

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

.vote button:hover .vote-arrow {
  fill: var(--accent-text);
  stroke: var(--accent-text);
}

/* Pressed: the gold fill, a bold count, and a gold edge that stands out from the page at 3:1. The arrow takes the
   colour of the count (this rule comes after the hover one, so a pressed arrow never turns gold on gold). */
.vote button[aria-pressed="true"] {
  background: var(--mark);
  border-color: var(--accent-text);
  color: var(--mark-text);
  font-weight: 700;
}

.vote button[aria-pressed="true"] .vote-arrow {
  fill: currentColor;
  stroke: currentColor;
}

/* ---- Post page ---- */

.post-header {
  margin-bottom: 1.4rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.post-header .post-title {
  font-size: clamp(1.75rem, 1.35rem + 2vw, 2.25rem);
  line-height: 1.14;
  letter-spacing: -0.012em;
  margin: 0.25rem 0 0.75rem;
}

.post-header .post-title a {
  color: var(--text);
  text-decoration: none;
}

.post-header .post-title a:hover {
  text-decoration: underline;
  text-decoration-thickness: 0.05em;
}

.post-header .post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.6rem;
  font-size: 0.875rem;
}

.post-body,
.post-feedback,
.comment-body {
  font-family: var(--serif);
  overflow-wrap: anywhere;
}

.post-body {
  font-size: 1.125rem;
  line-height: 1.65;
  max-width: 40rem;
}

/* "What I'd like feedback on": the author's question to readers, set apart on a raised panel. */
.post-feedback {
  max-width: 40rem;
  margin: 1.75rem 0;
  padding: 1rem 1.15rem;
  font-size: 1.0625rem;
  line-height: 1.6;
  background: var(--surface);
  border-radius: var(--radius);
}

.post-feedback h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--muted);
}

.post-feedback > :last-child {
  margin-bottom: 0;
}

.edited {
  font-size: 0.8125rem;
  font-style: italic;
  color: var(--muted);
}

/* The small words on a meta line that do something (edit, flag, Delete, Remove, Restore) read as quiet links. */
.post-edit,
.comment-edit {
  min-width: 1.5rem;
  font-size: 0.8125rem;
}

.post-meta .post-edit,
.comment-meta .comment-edit {
  color: var(--muted);
}

.post-meta .post-edit:hover,
.comment-meta .comment-edit:hover {
  color: var(--text);
}

/* A small form that sits on a meta line as if it were a link (an admin's Restore). */
.inline-form {
  display: inline;
  margin: 0;
}

.inline-form button {
  min-height: 1.5rem;
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.15rem 0;
  background: none;
  border: 0;
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.inline-form button:hover {
  text-decoration-thickness: 0.12em;
}

/* Rich text produced by the markup renderer */
.post-body ul,
.post-body ol,
.comment-body ul,
.comment-body ol,
.post-feedback ul,
.post-feedback ol {
  padding-left: 1.4rem;
  margin: 0 0 0.9rem;
}

.post-body li,
.comment-body li {
  margin-bottom: 0.25rem;
}

.post-body li::marker,
.comment-body li::marker {
  color: var(--muted);
}

blockquote {
  margin: 0 0 0.9rem;
  padding-left: 1rem;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 0.05em 0.3em;
}

pre {
  overflow-x: auto;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 0.9rem;
  line-height: 1.5;
}

pre code {
  border: 0;
  padding: 0;
  background: none;
}

/* The local mailbox (development only): a message is read whole, so its long links wrap instead of scrolling. */
.dev-mail pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---- Comments ---- */

.comments {
  margin-top: 2.5rem;
}

.comments > h2 {
  margin-top: 0;
}

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

/* Each reply level steps in a little and keeps a thread line; small steps keep depth 6 readable on a phone. */
.comment-list .comment-list {
  margin-left: 0.3rem;
  padding-left: 0.7rem;
  border-left: 2px solid var(--line);
}

@media (min-width: 40rem) {
  .comment-list .comment-list {
    margin-left: 0.5rem;
    padding-left: 1.1rem;
  }
}

.comment {
  padding: 0.7rem 0.6rem 0.45rem;
  margin: 0 -0.6rem;
  border-radius: var(--radius);
  scroll-margin-top: 1rem;
}

.comment:target {
  background: var(--mark-soft);
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.65rem;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.comment-age {
  color: var(--muted);
  text-decoration: none;
}

.comment-age:hover {
  color: var(--text);
  text-decoration: underline;
}

.comment-meta .post-points {
  font-variant-numeric: tabular-nums;
}

.comment-body {
  font-size: 1.0625rem;
  line-height: 1.6;
  max-width: 40rem;
}

.comment-body > :last-child {
  margin-bottom: 0.35rem;
}

.comment-deleted {
  margin: 0;
  font-size: 0.9375rem;
  font-style: italic;
  color: var(--muted);
}

details.reply {
  margin: 0.1rem 0 0.25rem;
}

details.reply > summary {
  display: inline-block;
  min-width: 1.5rem;
  padding: 0.2rem 0;
  list-style: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--link);
  cursor: pointer;
}

details.reply > summary:hover {
  text-decoration: underline;
}

details.reply > summary::-webkit-details-marker {
  display: none;
}

details.reply[open] > summary {
  margin-bottom: 0.4rem;
}

details.reply form {
  max-width: 36rem;
}

.sign-in-prompt {
  margin: 1rem 0;
}

.comment-form {
  margin: 1rem 0 1.75rem;
}

/* ---- Forms ---- */

form p {
  margin: 0 0 1.1rem;
}

.field label,
details.reply label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field small,
fieldset small {
  display: block;
  margin-top: 0.35rem;
  line-height: 1.4;
}

input[type="text"],
input[type="email"],
input[type="url"],
textarea,
select {
  display: block;
  width: 100%;
  max-width: 36rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
}

/* Inputs are surface-coloured, so muted text meets 4.5:1; opacity 1 undoes Firefox's faded placeholder. */
::placeholder {
  color: var(--muted);
  opacity: 1;
}

/* What is typed here is read in the serif once posted, so it is written in it too. */
textarea {
  resize: vertical;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.55;
}

select {
  width: auto;
  min-width: 12rem;
}

input[type="radio"],
input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0 0.45rem 0 0;
  vertical-align: -0.25em;
  accent-color: var(--accent-text);
}

/* Choice labels read in regular weight. The label that holds its box is the tap target: the box keeps its drawn size,
   and the label around it is at least 24 by 24 CSS pixels (a box, its gap and text are wider than that). A label that
   is already a block (in a .field) stays one; elsewhere it becomes an inline block so its height counts. */
.field label:has(input[type="checkbox"]) {
  font-weight: 400;
}

:where(label:has(> input[type="checkbox"], > input[type="radio"])) {
  display: inline-block;
}

label:has(> input[type="checkbox"], > input[type="radio"]) {
  min-height: 1.5rem;
  padding-block: 0.2rem;
}

fieldset {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem 0.3rem;
  margin: 0 0 1.25rem;
  max-width: 36rem;
}

legend {
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0 0.4rem;
}

fieldset p {
  margin-bottom: 0.75rem;
}

/* A choice's hint (after a line break) starts under the label's text, not under its radio button. */
fieldset label ~ small {
  padding-left: 1.95rem;
}

/* ---- Submit: the type picker, and the fields that follow the type ---- */

/* The three post types are three cards in a row; each card is the label of its radio button, so all of it can be
   pressed. */
.type-picker {
  border: 0;
  padding: 0;
}

.type-picker legend {
  padding: 0;
  margin-bottom: 0.5rem;
}

.type-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.type-options > .type-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  align-content: start;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  cursor: pointer;
}

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

.type-option small {
  grid-column: 1 / -1;
  margin-top: 0.3rem;
}

.type-options > .type-option:hover {
  border-color: var(--text);
}

/* The picked type: the gold edge, drawn twice as heavy by an inner shadow so the card does not change size. */
.type-options > .type-option:has(input:checked) {
  background: var(--surface);
  border-color: var(--accent-text);
  box-shadow: inset 0 0 0 1px var(--accent-text);
}

.type-options > .type-option:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Until a type is picked the form is only the picker; after that it is only that type's fields. A browser that does
   not know :has() drops this whole rule and shows every field, as the form did before. */
.submit-form:not(:has(input[name="type"]:checked)) .typed,
.submit-form:has(input[name="type"][value="show"]:checked) .typed:not(.for-show),
.submit-form:has(input[name="type"][value="link"]:checked) .typed:not(.for-link),
.submit-form:has(input[name="type"][value="discuss"]:checked) .typed:not(.for-discuss) {
  display: none;
}

/* Wording that differs by type. The general version shows by default; once a type is picked it gives way to that
   type's own. The order of these four rules matters: a piece of wording may be both general and one type's. */
.submit-form .v-show,
.submit-form .v-link,
.submit-form .v-discuss {
  display: none;
}

.submit-form .v-any {
  display: inline;
}

.submit-form:has(input[name="type"]:checked) .v-any {
  display: none;
}

.submit-form:has(input[name="type"][value="show"]:checked) .v-show,
.submit-form:has(input[name="type"][value="link"]:checked) .v-link,
.submit-form:has(input[name="type"][value="discuss"]:checked) .v-discuss {
  display: inline;
}

/* On a phone the cards stack, each one a single line: the button, the name, then what it is for. */
@media (max-width: 30rem) {
  .type-options {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
  }

  .type-options > .type-option {
    grid-template-columns: auto auto minmax(0, 1fr);
    padding-block: 0.55rem;
  }

  .type-option small {
    grid-column: auto;
    margin: 0 0 0 0.75rem;
  }
}

button {
  font: inherit;
  border-radius: var(--radius);
  cursor: pointer;
}

/* Primary actions: every form's own submit button except the small inline ones. */
form:not(.vote, .inline-form, .account, .admin-inline, .confirm-form) > button[type="submit"] {
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.55rem 1.25rem;
  background: var(--button-bg);
  color: var(--button-text);
  border: 1px solid var(--button-bg);
}

form:not(.vote, .inline-form, .account, .admin-inline, .confirm-form) > button[type="submit"]:hover {
  opacity: 0.88;
}

/* A primary action that takes something away (Ban domain, Delete my account): outlined in the danger colour. */
form:not(.vote, .inline-form, .account, .admin-inline, .confirm-form) > button[type="submit"].danger {
  color: var(--danger);
  background: transparent;
  border-color: var(--danger);
}

.field-error {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--danger);
}

p.field-error {
  margin: 0 0 0.75rem;
}

.errors {
  max-width: 36rem;
  margin: 0 0 1rem;
  padding: 0.65rem 0.9rem 0.65rem 2rem;
  font-size: 0.9375rem;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid currentColor;
  border-radius: var(--radius);
}

/* ---- Moderation: flag control, owner notices, bot check ---- */

/* The flag control reads like the other meta-line words (edit, delete) until it is opened. */
details.flag {
  display: inline-block;
  font-size: 0.8125rem;
}

details.flag > summary {
  display: inline-block;
  min-width: 1.5rem;
  padding: 0.2rem 0;
  list-style: none;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.18em;
  cursor: pointer;
}

details.flag > summary::-webkit-details-marker {
  display: none;
}

details.flag > summary:hover {
  color: var(--text);
  text-decoration-color: currentColor;
}

/* Opened, it takes a line of its own in the meta row, so the reason menu and button fit a 360 px screen. */
details.flag[open] {
  flex-basis: 100%;
}

details.flag[open] > summary {
  color: var(--text);
}

details.flag .inline-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.5rem;
}

details.flag select {
  display: inline-block;
  width: auto;
  min-width: 0;
  font-size: 0.8125rem;
  padding: 0.25rem 0.45rem;
}

details.flag .inline-form button {
  padding: 0.25rem 0.75rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  text-decoration: none;
}

details.flag .inline-form button:hover {
  border-color: var(--text);
}

span.flag {
  font-size: 0.8125rem;
  font-style: italic;
  color: var(--muted);
}

/* A note to the author (or an admin) about an item's state: held, hidden or removed. Informative, not an error:
   the gold tint, with no edge of its own. */
.notice {
  max-width: 40rem;
  margin: 0 0 1rem;
  padding: 0.6rem 0.95rem;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--mark-soft);
  border-radius: var(--radius);
}

.comment .notice {
  margin: 0 0 0.35rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.8125rem;
}

/* Turnstile draws an iframe into this box; reserving its height stops the button jumping when it loads. */
.cf-turnstile {
  min-height: 65px;
  margin: 0 0 1rem;
}

noscript p {
  font-size: 0.875rem;
  color: var(--muted);
}

/* ---- Admin ---- */

/* Admin pages (body.wide) use a wider page than the reading column, header and footer included, so their tables fit. */
body.wide main {
  max-width: 72rem;
}

body.wide > header,
body.wide > footer {
  padding-inline: max(1rem, calc(50% - 35rem));
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 1.25rem;
  margin: 0 0 1.5rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9375rem;
}

.admin-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.3rem 0 0.5rem;
}

.admin-nav a:hover {
  color: var(--text);
}

/* The current page is marked the way the current tab is on the feeds (the rule is with the sort switch, above). */

/* Things the owner should fix before launch: the notice treatment, a panel that is seen but does not shout. */
.config-warnings {
  max-width: 46rem;
  margin: 0 0 1.5rem;
  padding: 0.7rem 0.95rem 0.7rem 2rem;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--mark-soft);
  border-radius: var(--radius);
}

.config-warnings li + li {
  margin-top: 0.3rem;
}

.admin-counts {
  list-style: none;
  max-width: 46rem;
  margin: 0 0 1rem;
  padding: 0;
  border-top: 1px solid var(--line);
}

.admin-counts li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

/* Wide tables scroll sideways inside this box; the page itself never does. It is focusable, for keyboard scrolling.
   It is also the containing block for anything positioned inside it (a visually hidden label in a ban form), which
   would otherwise sit outside the box's clipping and widen the page. */
.table-scroll {
  position: relative;
  overflow-x: auto;
  margin: 0 0 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.table-scroll:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.4;
}

.admin-table th,
.admin-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  overflow-wrap: break-word;
}

.admin-table tbody tr:last-child > * {
  border-bottom: 0;
}

.admin-table thead th {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  border-bottom-color: var(--line-strong);
}

.admin-table tbody th {
  font-weight: 400;
  white-space: nowrap;
}

/* Tables of counts: numbers right-aligned in even columns. */
.admin-table.numbers {
  font-variant-numeric: tabular-nums;
}

.admin-table.numbers td,
.admin-table.numbers thead th + th {
  text-align: right;
}

/* The excerpt shrinks and wraps (even inside a long URL) before the table has to scroll. */
.queue-table td:first-child {
  min-width: 10rem;
  overflow-wrap: anywhere;
}

/* The action forms and the ban confirmation wrap onto several lines when the cell is narrow; at full admin width they
   share one row. */
.queue-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.35rem;
}

.queue-actions .admin-inline {
  flex-wrap: wrap;
  margin: 0;
}

@media (min-width: 72rem) {
  .queue-actions,
  .queue-actions .admin-inline {
    flex-wrap: nowrap;
  }
}

.flag-reasons {
  list-style: none;
  margin: 0.15rem 0 0;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Small one-button action forms in a table cell. (The ban reason field is inside the ban confirmation, .confirm-form.) */
.admin-inline {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0.35rem 0.3rem 0;
  vertical-align: top;
}

.admin-inline button {
  min-height: 1.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.2rem 0.7rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--control-border);
  white-space: nowrap;
}

.admin-inline button:hover {
  border-color: var(--text);
}

/* Settings: fifteen short numeric fields in a grid, the on/off switch across the top. */
.settings-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1.1rem 1.5rem;
  align-items: start;
}

.settings-form .field {
  margin: 0;
}

.settings-form .field label {
  font-size: 0.875rem;
  line-height: 1.35;
}

.settings-form input[type="text"] {
  max-width: 8rem;
  font-variant-numeric: tabular-nums;
}

.settings-form .hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.settings-form .field-check,
.settings-form > button {
  grid-column: 1 / -1;
}

.settings-form > button {
  justify-self: start;
}

/* The hold-first-posts switch: its label sits beside the box, in regular weight like every choice label. */
.field-check label {
  display: inline;
  padding-block: 0.2rem;
  font-weight: 400;
}

/* ---- Motion ---- */

@media (prefers-reduced-motion: no-preference) {
  .vote button {
    transition: background-color 120ms ease, border-color 120ms ease;
  }
}

/* ---- Header at phone width ---- */

/* On a phone (360 px leaves 328 px inside the header's padding) the header is two lines:
     1. the site name, then the member's name (or Sign in) at the right;
     2. the five section links (at 14 px with small gaps they take about 215 px), and Submit at the right. */
@media (max-width: 30rem) {
  body > header {
    column-gap: 0.9rem;
  }

  body > header nav {
    column-gap: 0.75rem;
    font-size: 0.875rem;
  }

  .account-menu > summary {
    max-width: 7rem;
  }

  .post-row .post-title {
    font-size: 1.125rem;
  }
}

/* ---- Footer ---- */

/* The closing band, on the same column as the header. */
body > footer {
  padding: 1.1rem max(1rem, calc(50% - 22rem)) 2.25rem;
  background: var(--bg-deep);
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
}

body > footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
}

body > footer a {
  min-width: 1.5rem;
  padding: 0.15rem 0;
  color: var(--muted);
  text-decoration: none;
}

body > footer a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ---- Profiles ---- */

.profile-banned {
  display: inline-block;
  padding: 0 0.5rem;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius-small);
  vertical-align: 0.4em;
}

.profile-joined {
  margin: -0.7rem 0 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

/* A member's badge: a small label with a gold edge, beside their name in a thread and under it on their profile.
   The edge is the accent as a line; the word is ordinary text, so it reads on every background a name sits on. */
.member-badge {
  display: inline-block;
  padding: 0 0.45rem;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--text);
  border: 1px solid var(--accent-text);
  border-radius: 999px;
  white-space: nowrap;
}

/* On a profile it sits under the name, above the joined line. */
.profile-badge {
  margin: -0.6rem 0 1.1rem;
}

.profile-bio {
  max-width: 40rem;
  margin: 0 0 0.9rem;
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.25rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

.profile-links li {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Posts / Comments: the same row of words as Hot / New (its rules are with the sort switch), here standing on the
   rule that opens the list below it. */
.profile-tabs {
  margin: 1.5rem 0 0;
  border-bottom: 1px solid var(--line);
}

.profile-tabs a {
  padding-bottom: 0.5rem;
}

.profile-tabs + .post-list {
  border-top: 0;
}

/* An owner notice belongs to the row above it: the row's divider moves below the notice. */
.post-list > .post-row:has(+ .profile-notice) {
  border-bottom: 0;
  padding-bottom: 0.45rem;
}

.post-list > .profile-notice {
  margin: 0 0 0 4.25rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.post-list > .profile-notice + .post-row {
  margin-top: 0.9rem;
  border-top: 1px solid var(--line);
}

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

.profile-comments > li {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

/* The post a comment was made on: a title, set as titles are in the feed. */
.profile-comments > li > a,
.notifications > li > a:last-of-type {
  padding-block: 0.15rem;
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.profile-comments > li > a:hover,
.notifications > li > a:last-of-type:hover {
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
}

.profile-comments .post-age,
.notifications .post-age {
  margin-left: 0.3rem;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
}

/* A comment's opening words, quoted (used on profiles and in the replies list). */
.profile-excerpt {
  max-width: 40rem;
  margin-top: 0.4rem;
  padding-left: 0.9rem;
  border-left: 3px solid var(--line-strong);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.profile-comments .notice {
  margin: 0.5rem 0 0;
  padding: 0.3rem 0.7rem;
  font-size: 0.8125rem;
}

/* ---- Replies ---- */

.notifications {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
}

/* Every item keeps a 3px left edge, so read and unread text start at the same place. */
.notifications > li {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  overflow-wrap: anywhere;
}

/* The member who replied: named in weight, like an author on a meta line. */
.notifications > li > a:first-of-type {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.notifications > li > a:first-of-type:hover {
  text-decoration: underline;
}

/* Unread: the gold edge and the word "New", so colour is never the only sign. */
.notifications > li.unread {
  border-left-color: var(--mark);
}

.unread-mark {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--mark-text);
  background: var(--mark);
  border-radius: var(--radius-small);
  vertical-align: 0.1em;
}

/* ---- Member settings ---- */

/* Three sections down the page, each opened by a rule and its heading. */
.settings-profile,
.settings-preferences,
.settings-account {
  margin: 2rem 0 0;
  padding: 1.5rem 0 0.5rem;
  border-top: 1px solid var(--line);
}

.settings-profile > h2,
.settings-preferences > h2,
.settings-account > h2 {
  margin: 0 0 1rem;
}

/* The address can only be changed through the form below, so it reads as a fixed value, not a field. */
.account-email {
  display: inline-block;
  max-width: 100%;
  padding: 0.05rem 0.5rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-small);
  overflow-wrap: anywhere;
}

.settings-account > form + form {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

/* Deleting the account: its own tinted, danger-edged area at the end of the page. */
.settings-account > form[action="/settings/delete"] {
  max-width: 40rem;
  margin-top: 2rem;
  padding: 1.1rem clamp(0.85rem, 3vw, 1.25rem) 1.25rem;
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
}

.settings-account form[action="/settings/delete"] h3 {
  margin: 0 0 0.5rem;
  font-size: 1.0625rem;
  color: var(--danger);
}

.settings-account form[action="/settings/delete"] fieldset {
  background: var(--surface);
  border-color: var(--line-strong);
}

/* The username has to be typed exactly: a fixed-width face makes every character visible. */
.settings-account form[action="/settings/delete"] input[name="confirm"] {
  max-width: 20rem;
  font-family: var(--mono);
}

/* ---- One-message pages: confirm a new address, stop reply emails, sign-in link sent, errors ---- */

.message-page {
  max-width: 30rem;
  margin: 3rem auto 1rem;
  padding: 2rem clamp(1.1rem, 4vw, 2rem);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-wrap: anywhere;
}

.message-page h1 {
  margin: 0 0 0.75rem;
  font-size: 1.625rem;
}

.message-page p {
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.55;
}

.message-page form {
  margin-top: 1.25rem;
}

.message-page > :last-child {
  margin-bottom: 0;
}

/* ---- Sign in, choose a username, finish signing in: one short form on its own panel ---- */

.form-page {
  max-width: 27rem;
  margin: 2.5rem auto 1rem;
  padding: 1.75rem clamp(1.1rem, 4vw, 1.75rem) 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.form-page h1 {
  margin: 0 0 0.6rem;
  font-size: 1.625rem;
}

.form-page > p {
  color: var(--muted);
}

.form-page form {
  margin-top: 1.25rem;
}

/* On the panel an input takes the page colour, so it still reads as a well to type in. */
.form-page input[type="text"],
.form-page input[type="email"] {
  background: var(--bg);
}

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

/* ---- About, Guidelines, Privacy, Terms ---- */

.text-page {
  max-width: 38rem;
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
  overflow-wrap: break-word;
}

.text-page h1 {
  margin-bottom: 1.5rem;
}

.text-page h2 {
  margin: 2.5rem 0 0.6rem;
}

.text-page ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.text-page li {
  margin-bottom: 0.45rem;
}

.text-page li::marker {
  color: var(--muted);
}

.text-page a {
  overflow-wrap: anywhere;
}

/* The legal drafts are not final: a full gold band, the loudest thing on the page. */
.draft-marker {
  margin: -0.5rem 0 1.5rem;
  padding: 0.6rem 0.95rem;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--mark-text);
  background: var(--mark);
  border-radius: var(--radius);
}

/* ---- Confirmations: a control that opens to a question and a button (delete, remove, ban) ---- */

/* Closed, it reads like the control it replaced: a small underlined word in the danger colour, like edit and flag.
   Opened, it takes a line of its own in a meta row, and the question and the button follow the word on that line
   where they fit; on a phone they stack under it. */
details.confirm {
  display: inline-block;
  font-size: 0.8125rem;
}

details.confirm > summary {
  display: inline-block;
  min-width: 1.5rem;
  padding: 0.2rem 0;
  list-style: none;
  white-space: nowrap;
  color: var(--danger);
  text-decoration: underline;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

details.confirm > summary::-webkit-details-marker {
  display: none;
}

details.confirm > summary:hover {
  text-decoration-thickness: 0.12em;
}

details.confirm[open] {
  flex-basis: 100%;
}

details.confirm[open] > summary {
  color: var(--text);
}

.confirm-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin: 0 0 0 0.5rem;
}

.confirm-question {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.confirm-form button {
  min-height: 1.5rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--control-border);
  white-space: nowrap;
}

.confirm-form button:hover {
  border-color: var(--text);
}

/* Yes, delete / remove / ban: outlined in the danger colour, the outline doubling on hover. */
.confirm-form button.danger {
  color: var(--danger);
  border-color: var(--danger);
}

.confirm-form button.danger:hover {
  box-shadow: inset 0 0 0 1px var(--danger);
}

.confirm-form input[type="text"] {
  display: inline-block;
  width: 9rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
}

@media (max-width: 30rem) {
  .confirm-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin: 0.35rem 0 0.25rem;
  }
}

/* ---- Skip link and visually hidden text ---- */

.skip-link {
  position: absolute;
  left: -999rem;
  top: 0;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
  z-index: 100;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--focus);
  border-radius: var(--radius);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Forced colours (Windows contrast themes) ---- */

/* The browser drops backgrounds and box-shadows and repaints text and borders in the user's colours. Every state that
   the gold fill, a tint or a shadow shows gets a border or system colours instead. */
@media (forced-colors: active) {
  /* The mark beside the name is the site's logo: it keeps its own colours. */
  .site-name .site-mark {
    forced-color-adjust: none;
  }

  .draft-marker {
    border: 2px solid CanvasText;
  }

  .unread-mark,
  .account-unread,
  .post-type {
    border: 1px solid CanvasText;
  }

  /* Every reply keeps its 3px left edge; only an unread one shows it. */
  .notifications > li {
    border-left-color: Canvas;
  }

  .notifications > li.unread {
    border-left-color: Highlight;
  }

  .comment:target {
    outline: 2px solid Highlight;
  }

  .notice,
  .config-warnings,
  .post-feedback {
    border: 1px solid CanvasText;
  }

  .settings-account > form[action="/settings/delete"] {
    border-color: CanvasText;
  }

  .sort-switch a[aria-current="page"],
  .profile-tabs a[aria-current="page"],
  .admin-nav a[aria-current="page"],
  body > header nav a[aria-current="page"],
  .vote button[aria-pressed="true"] {
    forced-color-adjust: none;
    color: HighlightText;
    background: Highlight;
    border-color: Highlight;
  }

  /* The arrow is a drawing with its own colours, which this mode leaves alone: it takes the button's text colour,
     pressed or not, hovered or not. */
  .vote button .vote-arrow,
  .vote button:hover .vote-arrow,
  .vote button[aria-pressed="true"] .vote-arrow {
    fill: currentColor;
    stroke: currentColor;
  }

  /* The Submit button on the Submit page: a heavier edge, since its gold one is repainted like any other. */
  .header-submit[aria-current="page"] {
    border-width: 2px;
  }

  /* The picked post type is shown by its radio button; its card also gets a heavier edge. */
  .type-options > .type-option:has(input:checked) {
    border-width: 2px;
  }

  /* A current tab is now a filled box: a little room either side of its word. */
  .sort-switch a[aria-current="page"],
  .profile-tabs a[aria-current="page"],
  .admin-nav a[aria-current="page"] {
    padding-inline: 0.5rem;
  }

  :focus-visible {
    outline-color: Highlight;
  }

  /* The bar along main's top edge is a shadow, which this mode drops: an outline inside the edge instead. */
  main:focus-visible {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }
}
