/* Visual layer for the ontology feedback site. Class names are the contract with
   the templates; only the treatment lives here. */

:root {
  color-scheme: light;

  --ink: #15181d;
  --ink-soft: #3a424d;
  --muted: #4f5a67;
  --line: #e2e6eb;
  --line-strong: #cfd6de;
  --paper: #fdfdfc;
  --wash: #f5f7f9;
  --wash-strong: #eef2f6;
  --accent: #0d5d86;
  --accent-soft: #e8f2f9;
  --accent-ink: #ffffff;
  --warn: #8c2416;
  --warn-soft: #fdeeec;
  --ok: #1c6b46;
  --ok-soft: #e9f6ef;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20, 26, 34, 0.06), 0 1px 3px rgba(20, 26, 34, 0.04);
  --shadow-md: 0 6px 16px rgba(20, 26, 34, 0.1), 0 2px 6px rgba(20, 26, 34, 0.06);
  --shadow-lg: 0 18px 44px rgba(20, 26, 34, 0.16), 0 4px 12px rgba(20, 26, 34, 0.08);

  --sidebar-width: 19rem;
  --measure: 42rem;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: ui-serif, Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}


* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 40;
  padding: 0.6rem 1rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* Shell ------------------------------------------------------------------ */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-areas:
    "header header"
    "sidebar main"
    "footer footer";
  min-height: 100vh;
}

.site-header {
  grid-area: header;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 1.25rem;
  padding: 0.9rem clamp(1rem, 3vw, 2.25rem);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.12em;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Sidebar ---------------------------------------------------------------- */

.sidebar {
  grid-area: sidebar;
  position: sticky;
  top: 3.4rem;
  align-self: start;
  max-height: calc(100vh - 3.4rem);
  overflow-y: auto;
  padding: 1.25rem 0.6rem 2.5rem 0;
  background: var(--wash-strong);
  border-right: 1px solid var(--line-strong);
  font-size: 0.9375rem;
  scrollbar-width: thin;
}

.nav-group {
  margin: 0 0 1.1rem;
  padding-top: 0.75rem;
  border-top: 1px solid color-mix(in srgb, var(--line-strong) 55%, transparent);
}

.nav-group:first-child {
  padding-top: 0;
  border-top: 0;
}

.nav-heading {
  margin: 0 0 0.4rem;
  padding: 0 0.85rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-heading a {
  color: inherit;
  text-decoration: none;
}

.nav-heading a:hover {
  color: var(--accent);
}

.nav-group:first-child .nav-heading {
  margin-top: 0;
}

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

.nav-list a {
  display: block;
  padding: 0.28rem 0.85rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-left: 3px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nav-list a:hover {
  color: var(--ink);
  background: var(--wash-strong);
}

.nav-list a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.nav-heading a[aria-current="page"] {
  color: var(--accent);
}

/* Reading surface -------------------------------------------------------- */

main {
  grid-area: main;
  min-width: 0;
  padding: clamp(1.5rem, 3vw, 2.75rem) clamp(1rem, 4vw, 3.5rem) 4rem;
}

.doc,
.index {
  max-width: var(--measure);
  margin: 0 auto;
}

/* A page that carries a diagram takes the whole width the shell gives it. The
   relationship maps are the widest content in the corpus, and holding them to a
   reading measure would force a sideways scroll for every one of them. Pages of
   prose alone keep the measure. */
.doc:has(figure.diagram) {
  max-width: none;
}

.doc-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

/* Breadcrumb trail ------------------------------------------------------- */

/* The trail replaces the inert section label that used to sit here: it names
   where the page sits and gets the reader back up without opening the sidebar.
   It keeps the label's quiet treatment so the title stays the loudest thing in
   the header, and it wraps instead of overflowing when a deep page is read on a
   narrow screen. */
.breadcrumbs {
  margin: 0 0 0.4rem;
}

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  row-gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.breadcrumb-item {
  display: flex;
  align-items: baseline;
  min-width: 0;
  overflow-wrap: anywhere;
}

.breadcrumb-item + .breadcrumb-item {
  margin-left: 0.45rem;
}

.breadcrumb-separator {
  margin-right: 0.45rem;
  color: var(--muted);
  font-weight: 400;
}

.breadcrumb-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.breadcrumb-link:hover,
.breadcrumb-link:focus-visible {
  color: var(--ink);
  border-bottom-color: currentColor;
}

.breadcrumb-current {
  color: var(--ink-soft);
}

.doc-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.65rem, 2.6vw, 2.05rem);
  font-weight: 620;
  line-height: 1.18;
  letter-spacing: -0.015em;
}

.doc-body {
  color: var(--ink);
}

.doc-body > h1:first-child {
  display: none;
}

:is(.doc-body, .markdown) h2 {
  margin: 2rem 0 0.75rem;
  padding-top: 0.9rem;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 620;
  line-height: 1.25;
  letter-spacing: -0.01em;
  border-top: 1px solid var(--line);
}

:is(.doc-body, .markdown) h3 {
  margin: 1.9rem 0 0.6rem;
  font-size: 1.0625rem;
  font-weight: 680;
  letter-spacing: -0.005em;
}

:is(.doc-body, .markdown) p,
:is(.doc-body, .markdown) ul,
:is(.doc-body, .markdown) ol {
  margin: 0.85rem 0;
}

:is(.doc-body, .markdown) li {
  margin: 0.3rem 0;
}

:is(.doc-body, .markdown) a {
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

:is(.doc-body, .markdown) code {
  padding: 0.12em 0.36em;
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

:is(.doc-body, .markdown) pre {
  margin: 1.2rem 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 1.55;
}

:is(.doc-body, .markdown) pre code {
  padding: 0;
  background: none;
  border: 0;
  font-size: 0.875rem;
}

:is(.doc-body, .markdown) blockquote {
  margin: 1.4rem 0;
  padding: 0.85rem 1.1rem;
  color: var(--ink-soft);
  background: var(--wash);
  border-left: 3px solid var(--line-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
}

:is(.doc-body, .markdown) blockquote > :first-child {
  margin-top: 0;
}

:is(.doc-body, .markdown) blockquote > :last-child {
  margin-bottom: 0;
}

:is(.doc-body, .markdown) table {
  width: 100%;
  margin: 1.3rem 0;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.9375rem;
}

:is(.doc-body, .markdown) td,
:is(.doc-body, .markdown) th {
  padding: 0.55rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

:is(.doc-body, .markdown) th {
  font-weight: 650;
  background: var(--wash);
}

:is(.doc-body, .markdown) tbody tr:last-child td {
  border-bottom: 0;
}

:is(.doc-body, .markdown) tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--wash) 55%, transparent);
}

:is(.doc-body, .markdown) hr {
  margin: 2.4rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

:is(.doc-body, .markdown) img {
  max-width: 100%;
  height: auto;
}

/* Reading hint ----------------------------------------------------------- */

/* The reading surface has one entry point, so say so above the text instead of
   leaving the visitor to discover selection by accident. */
.read-hint {
  margin: 0 0 1.5rem;
  padding: 0.55rem 0.8rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Selection toolbar and panel -------------------------------------------- */

.selection-toolbar {
  position: absolute;
  z-index: 30;
  display: flex;
  gap: 0.25rem;
  padding: 0.3rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.selection-toolbar[hidden] {
  display: none;
}

.selection-action {
  padding: 0.42rem 0.7rem;
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.selection-action:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.panel {
  margin: 2rem 0;
  padding: 1.35rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.panel[hidden] {
  display: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 620;
  border: 0;
  padding: 0;
}

.panel-close {
  padding: 0.25rem 0.6rem;
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.panel-close:hover {
  color: var(--ink);
  background: var(--wash);
}

.panel-context {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.panel-passage h3,
.panel-original h3 {
  margin: 1rem 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-passage blockquote,
.panel-original blockquote,
.panel-quote {
  margin: 0.25rem 0 1rem;
  padding: 0.7rem 0.9rem;
  color: var(--ink-soft);
  background: var(--wash);
  border-left: 3px solid var(--line-strong);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.panel-quote {
  max-height: 14rem;
  overflow: auto;
  font-size: 0.85rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.panel-field,
.panel-mode {
  margin-bottom: 1rem;
}

.proposal {
  margin: 0.5rem 0 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.panel-form label {
  display: block;
  margin: 0.9rem 0 0.3rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.panel-form input[type="email"],
.panel-form input[type="text"],
.panel-form textarea,
.panel-form input:not([type]),
:is(.status, .queue) input[type="text"],
:is(.status, .queue) input[type="email"],
:is(.status, .queue) textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.panel-form textarea,
:is(.status, .queue) textarea {
  min-height: 8rem;
  resize: vertical;
}

.panel-form input:focus,
.panel-form textarea:focus,
:is(.status, .queue) input:focus,
:is(.status, .queue) textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.panel-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin: 0.5rem 0 0;
  padding: 0;
  border: 0;
}

.panel-modes legend {
  padding: 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.mode-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9375rem;
}

.panel-mode[hidden] {
  display: none;
}

.field-help {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.visually-hidden-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.35rem;
}

.panel-submit,
:is(.status, .queue) button.panel-submit,
:is(.status, .queue) button[type="submit"] {
  padding: 0.55rem 1rem;
  color: var(--accent-ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 650;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.panel-submit:hover,
:is(.status, .queue) button[type="submit"]:hover {
  filter: brightness(1.08);
}

.panel-cancel {
  padding: 0.55rem 0.9rem;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.9375rem;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.panel-cancel:hover {
  background: var(--wash);
}

.panel-error,
.error {
  margin: 0.9rem 0 0;
  padding: 0.6rem 0.8rem;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.panel-note,
.notice,
.hint {
  margin: 0.9rem 0 0;
  padding: 0.6rem 0.8rem;
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid color-mix(in srgb, var(--ok) 28%, transparent);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

/* The forget control sits under the panel form, never inside it, so a form
   nested in a form cannot happen. */
.panel-forget {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.panel-forget .field-help {
  margin-bottom: 0.6rem;
}

.panel-forget-button {
  padding: 0.4rem 0.75rem;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.875rem;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.panel-forget-button:hover {
  background: var(--wash);
}

/* Index ----------------------------------------------------------------- */

.index h1 {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.25rem);
  max-width: 26ch;
  font-weight: 620;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0 0 1.6rem;
  color: var(--ink-soft);
  font-size: 1.0625rem;
}

.index-steps {
  margin: 0 0 2rem;
  padding: 0;
  counter-reset: step;
  list-style: none;
  display: grid;
  gap: 0.7rem;
}

.index-steps li {
  position: relative;
  padding: 0.7rem 0.9rem 0.7rem 2.6rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: 0.9375rem;
}

.index-steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0.7rem;
  top: 0.62rem;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--accent-soft);
  border-radius: 50%;
}

.index-group {
  margin: 0 0 1.1rem;
  padding: 1rem 1.1rem 0.9rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.index-group h2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.6rem;
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 620;
}

.index-group h2 a {
  color: inherit;
  text-decoration: none;
}

.index-group h2 a:hover {
  color: var(--accent);
}

.count {
  flex: none;
  padding: 0.05rem 0.45rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.index-links {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2 12rem;
  column-gap: 1.4rem;
  font-size: 0.9375rem;
}

.index-links li {
  break-inside: avoid;
  margin: 0 0 0.2rem;
}

.index-links a {
  text-decoration: none;
}

.index-links a:hover {
  text-decoration: underline;
}

.index-total {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.875rem;
}

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

.site-footer {
  grid-area: footer;
  padding: 1.5rem clamp(1rem, 3vw, 2.25rem);
  color: var(--muted);
  font-size: 0.875rem;
  background: var(--wash);
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0;
}

/* Moderation queue and status pages ------------------------------------- */

.queue,
.status {
  max-width: 52rem;
  margin: 0 auto;
}

.queue h1,
.status h1 {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 2.6vw, 2rem);
  font-weight: 620;
  letter-spacing: -0.015em;
}

.queue h2,
.status h2 {
  margin: 2rem 0 0.75rem;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 620;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.queue h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
}

.submission {
  display: grid;
  grid-template-columns: minmax(6rem, max-content) minmax(0, 1fr);
  gap: 0.3rem 1rem;
  margin: 0 0 1.1rem;
  padding: 0.9rem 1rem;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.submission dt {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.submission dd {
  margin: 0;
  font-size: 0.9375rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.status-link {
  display: block;
  margin: 0.6rem 0;
  padding: 0.7rem 0.85rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  background: var(--wash);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}

.admin-row {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.admin-row h3 {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 620;
}

.admin-row h4 {
  margin: 1rem 0 0.4rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.issue-title {
  width: 100%;
}

.preview {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.reply,
.message {
  margin: 1rem 0;
  padding: 1rem 1.1rem;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.reply h2,
.message h2 {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

:is(.status, .queue) form {
  margin: 0;
}

:is(.status, .queue) :is(.preview-form, .approve-form, .reject-form, .reply form) {
  margin: 0.75rem 0 0;
}

:is(.status, .queue) label {
  display: block;
  margin: 0.75rem 0 0.3rem;
  font-size: 0.875rem;
  font-weight: 600;
}

:is(.status, .queue) button {
  padding: 0.5rem 0.85rem;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

:is(.status, .queue) button:hover {
  background: var(--wash);
}

/* Diagrams -------------------------------------------------------------- */

/* A Mermaid diagram is a pre-rendered SVG served as an image, so its own
   stylesheet applies without a page style exception. On a diagram page the
   reading column is the full shell width, and a diagram fits itself to that
   width: the widest maps shrink until the whole graph is visible instead of
   forcing a sideways scroll, while a small diagram keeps its natural size
   rather than being stretched. The link opens the asset at full size for the
   maps whose labels need it. */
figure.diagram {
  margin: 1.75rem 0 2.25rem;
  width: 100%;
  overflow-x: auto;
  padding: 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

figure.diagram a.diagram-open {
  display: block;
  color: inherit;
  border-bottom: 0;
}

figure.diagram img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  margin: 0 auto;
}

figure.diagram figcaption.diagram-caption {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: center;
}

/* Narrow screens -------------------------------------------------------- */

@media (max-width: 62rem) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "sidebar"
      "main"
      "footer";
  }

  .sidebar {
    position: static;
    max-height: none;
    padding: 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .index-links {
    columns: 1;
  }

  /* A phone gets a shorter canvas, because a long one pushes the legend and the
     relation table out of reach, and the graph is zoomed and panned anyway. */
  .diagram-graph .graph-canvas {
    height: clamp(26rem, 60vh, 34rem);
  }

  /* Five columns do not fit a phone: the relation table keeps its columns and
     scrolls sideways instead of squeezing them into unreadable wraps. */
  .diagram-graph .graph-relations {
    overflow-x: auto;
  }

  .diagram-graph .graph-relations-table {
    min-width: 32rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}

@media print {
  .sidebar,
  .selection-toolbar,
  .panel,
  .skip-link {
    display: none;
  }

  /* Paper cannot scroll, so a wide diagram shrinks to the page instead. */
  figure.diagram {
    overflow: visible;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  figure.diagram img {
    max-width: 100%;
  }

  /* Paper cannot show a canvas, so a printed map page carries the graph's legend
     and relation table instead of the graph. */
  .diagram-graph .graph-controls,
  .diagram-graph .graph-canvas {
    display: none;
  }

  .shell {
    display: block;
  }
}

/* The sign-in page. The form is the only way in, so it sits in the reading
   column as one short labelled card; the same field and button treatment the
   queue uses keeps it unremarkable. */
.login-form {
  display: grid;
  gap: 0.35rem;
  max-width: 24rem;
  margin: 1.5rem 0 0;
  padding: 1.1rem 1.2rem 1.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.login-form label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  color: var(--ink);
  font: inherit;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.login-form input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-form button {
  margin-top: 0.8rem;
  padding: 0.55rem 1rem;
  color: var(--accent-ink);
  font: inherit;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.login-form button:hover {
  filter: brightness(1.08);
}

/* Sign out is a form, never a link, so no page can end a session by being
   fetched. */
.logout-form {
  margin: 0 0 1.2rem;
}

.logout-form button {
  padding: 0.45rem 0.85rem;
  color: var(--ink);
  font: inherit;
  background: var(--wash);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.logout-form button:hover {
  background: var(--wash-strong);
}

/* Walkthrough ----------------------------------------------------------- */

/* The guided reading order is the front door for a new reader: one card per
   stage of the primer's loop, each listing the pages it covers as a row with
   two marks beside the link. The markup is complete without a page script, so
   a reader with JavaScript disabled still gets the order and every link. */
.walkthrough h1 {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.25rem);
  max-width: 26ch;
  font-weight: 620;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.walkthrough-invite {
  display: grid;
  gap: 0.15rem;
  margin: 0 0 1.75rem;
  padding: 0.85rem 1rem;
  background: var(--accent-soft);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}

.walkthrough-invite-link {
  font-weight: 640;
  text-decoration: none;
}

.walkthrough-invite-link:hover {
  text-decoration: underline;
}

.walkthrough-invite-note {
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.walkthrough-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 1.4rem;
  padding: 0.6rem 0.9rem;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.walkthrough-tally {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  font-weight: 600;
}

.walkthrough-reset {
  padding: 0.35rem 0.75rem;
  color: var(--warn);
  font: inherit;
  font-size: 0.875rem;
  background: var(--warn-soft);
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.walkthrough-reset:hover {
  filter: brightness(0.97);
}

.walkthrough-reset[hidden] {
  display: none;
}

.walkthrough-stage {
  margin: 0 0 1.1rem;
  padding: 1rem 1.1rem 0.9rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.walkthrough-stage-heading {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin: 0 0 0.3rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 620;
}

.walkthrough-step {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--accent-soft);
  border-radius: 50%;
  transform: translateY(0.15rem);
}

.walkthrough-summary {
  margin: 0 0 0.35rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.walkthrough-stage-count {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.walkthrough-terms {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.walkthrough-term {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0;
  border-top: 1px solid var(--line);
}

.walkthrough-term:first-child {
  border-top: 0;
}

.walkthrough-term-link {
  font-size: 0.9375rem;
  text-decoration: none;
}

.walkthrough-term-link:hover {
  text-decoration: underline;
}

.walkthrough-marks {
  display: flex;
  gap: 0.3rem;
}

.walkthrough-mark {
  padding: 0.2rem 0.55rem;
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
}

.walkthrough-mark:hover {
  background: var(--wash);
}

.walkthrough-mark[aria-pressed="true"] {
  color: var(--accent-ink);
  font-weight: 640;
  background: var(--accent);
  border-color: var(--accent);
}

.walkthrough-mark[data-mark="question"][aria-pressed="true"] {
  color: var(--ink);
  background: var(--warn-soft);
  border-color: var(--warn);
}

/* The counts and the reset control are rendered by the page script, because
   without it there is no state to report. The note stands in their place and
   says so. */
.walkthrough-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* The relationship map's graph ------------------------------------------ */

/* The whole-graph diagram is drawn by the page script from the relations the map
   states, because 38 objects and 123 relations are unreadable as one image scaled
   to the window. The figure keeps the card treatment of every other diagram; the
   canvas is the box the graph pans and zooms inside, and every part of the figure
   below it, the legend, the relation table and the link to the diagram, is page
   text that needs no script. */
.diagram-graph .graph-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  margin: 0 0 0.75rem;
}

.diagram-graph .graph-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.diagram-graph .graph-control {
  padding: 0.3rem 0.75rem;
  color: var(--accent);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.diagram-graph .graph-control:hover:not(:disabled) {
  background: var(--wash);
}

.diagram-graph .graph-clear {
  margin-left: auto;
}

.diagram-graph .graph-clear:disabled {
  color: var(--muted);
  cursor: default;
}

.diagram-graph .graph-hint {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* The selection report is the reading of the graph that does not depend on
   seeing it, so it stays at body size rather than in the small print. */
.diagram-graph .graph-status {
  flex-basis: 100%;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

/* The canvas is a fixed box the graph lives in. Its height is a reading decision:
   a graph squashed into a short strip cannot show a label. The wash is the graph's
   surface, which the white nodes sit on. */
.diagram-graph .graph-canvas {
  height: clamp(33rem, 74vh, 56rem);
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: grab;
  touch-action: none;
}

.diagram-graph .graph-canvas:active {
  cursor: grabbing;
}

/* Without the script the canvas is never filled; it says so rather than leaving
   an empty box, and the relation table below it still holds the graph. */
.diagram-graph .graph-canvas:empty::before {
  content: "The graph is drawn by this page's script.";
  display: block;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.diagram-graph .graph-fallback {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.diagram-graph .graph-legend {
  margin: 0.9rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.diagram-graph .graph-mark {
  padding: 0.05rem 0.3rem;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.875em;
  font-weight: 700;
  background: var(--wash-strong);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* The relation table is the graph as text: the fallback for a reader without the
   script, and the form a browser search and a screen reader can walk. It is long,
   so it ships folded away. */
.diagram-graph .graph-relations {
  margin: 1rem 0 0;
  font-size: 0.9375rem;
}

.diagram-graph .graph-relations summary {
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

.diagram-graph .graph-relations-table {
  width: 100%;
  margin-top: 0.6rem;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.diagram-graph .graph-relations-table th,
.diagram-graph .graph-relations-table td {
  padding: 0.3rem 0.55rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.diagram-graph .graph-relations-table th {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
  border-bottom: 1px solid var(--line-strong);
}

/* Term proposals -------------------------------------------------------- */

.site-header .header-link {
  margin-left: auto;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.site-header .header-link:hover {
  text-decoration: underline;
}

.propose h1 {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.25rem);
  font-weight: 620;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.propose-form {
  max-width: 46rem;
}

.propose-field {
  margin-bottom: 1rem;
}

.propose-form label {
  display: block;
  margin: 0.9rem 0 0.3rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.propose-form input[type="text"],
.propose-form input[type="email"],
.propose-form textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.propose-form textarea {
  min-height: 8rem;
  resize: vertical;
}

.propose-form input:focus,
.propose-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.propose-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.35rem;
}

.propose-actions button[type="submit"] {
  padding: 0.55rem 1rem;
  color: var(--accent-ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 650;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.propose-actions button[type="submit"]:hover {
  filter: brightness(1.08);
}
