/* Held in Common: styles for the node and commons pages.
 *
 * Look: the "Common Signal" system from heldincommon.org. Space Grotesk for
 * text, Space Mono for labels and headings, Cormorant for ledes; pink, blue,
 * jade and violet on white; hard ink hairlines; flat, square-cornered blocks.
 *
 * How this file is organised:
 *   1. Design tokens: every colour, font, size and space. Change them here
 *      and the whole site follows.
 *   2. Base: the page, links, focus.
 *   3. Shared patterns: the mono label, buttons, form controls, panels.
 *   4. Site frame: role bar, top bar, footer.
 *   5. Page parts, in the order a visitor meets them.
 *   6. Small screens.
 *
 * Conventions: components read tokens, never raw values; a coloured thing
 * takes its colour from a --tone variable set by a modifier class; shared
 * looks are grouped selectors inside :where(), which adds no specificity, so
 * a component can still override any part of them.
 */

/* 1. Design tokens --------------------------------------------------------- */

:root {
  /* Brand colours */
  --pink: #ff2d9b;
  --blue: #1f5cff;
  --jade: #12b37d;
  --jade-ink: #0a7a54;
  --jade-wash: #effaf5;
  --violet: #8b3fd9;
  --violet-ink: #6a2caf;

  /* Neutrals */
  --ink: #111;
  --gray: #6f6f6f;
  --faint: #a4a29b;
  --white: #fff;
  --cream: #f2efe8;
  --cream-deep: #e3e0d8;
  --line: rgb(17 17 17 / 15%);

  /* What each colour is for */
  --text: var(--ink);
  --text-muted: var(--gray);
  --surface: var(--white);
  --surface-sunk: var(--cream);
  --link: var(--blue);
  --accent: var(--pink);

  /* Fonts */
  --font-text: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-serif: "Cormorant", Georgia, serif;

  /* Type sizes (rem, so they follow the reader's browser setting) */
  --text-2xs: 0.6875rem; /* 11px: badges, chips */
  --text-xs: 0.75rem; /* 12px: labels, buttons */
  --text-sm: 0.875rem; /* 14px: fine print */
  --text-hint: 0.9375rem; /* 15px: helper text */
  --text-md: 1rem; /* 16px */
  --text-base: 1.0625rem; /* 17px: body */
  --text-lg: 1.1875rem; /* 19px: reading text */
  --text-xl: 1.375rem; /* 22px: card names */
  --text-lede: clamp(1.25rem, 2.4vw, 1.75rem);
  --text-display: clamp(2.5rem, 6.5vw, 4.75rem);
  --track: 0.08em; /* letter-spacing for mono labels */
  --track-wide: 0.12em;

  /* Space (a 4px scale) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 2.5rem;
  --space-8: 3.5rem;
  --space-9: 4.5rem;

  /* Lines and widths */
  --rule: 1px solid var(--ink);
  --rule-strong: 1.5px solid var(--ink);
  --rule-soft: 1px solid var(--line);
  --accent-edge: 4px;
  --focus: 2px solid var(--blue);
  --measure: 70ch; /* longest comfortable line of text */
  --panel-width: 640px;
  --page-width: 1180px;
  --logo-height: 2.875rem; /* 46px, as on heldincommon.org */

  /* Icons */
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23111111' stroke-width='1.8'/%3E%3C/svg%3E");
}

/* 2. Base ------------------------------------------------------------------ */

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

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font: var(--text-base) / 1.5 var(--font-text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-underline-offset: 3px;
}

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

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

/* Element defaults use :where() (no specificity) so any class overrides them. */
:where(button) {
  font: inherit;
  cursor: pointer;
}

/* 3. Shared patterns ------------------------------------------------------- */

/* The mono label: small, bold, upper-case monospace. Used for labels,
   buttons, badges and navigation; each sets only its own size and colour. */
:where(
    .field-label,
    .section-h,
    .topbar-links,
    .primary,
    .secondary,
    .secondary-link,
    .link-btn,
    .vis-badge,
    .commons-status,
    .add-commons summary,
    .role-bar
  ) {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-xs);
  letter-spacing: var(--track);
  text-transform: uppercase;
}

/* Page headings end in a pink dot. */
.intro h1::after {
  content: ".";
  color: var(--accent);
}

/* Muted helper text under a field or panel. */
.hint {
  margin: var(--space-3) 0 0;
  font-size: var(--text-hint);
  color: var(--text-muted);
}

.section-h {
  margin: 0 0 var(--space-2);
  letter-spacing: var(--track-wide);
  color: var(--text-muted);
}

.field-label {
  display: block;
  margin-bottom: var(--space-3);
}

/* Buttons. .primary is the one main action on a page; .secondary is every
   other button; .link-btn and .linklike look like links. */

.primary,
.secondary {
  display: inline-block;
  border: 0;
  border-radius: 0;
  text-decoration: none;
}

.primary {
  padding: 18px 34px;
  font-size: 0.8125rem;
  background: var(--accent);
  color: var(--white);
}

.primary:hover {
  background: var(--ink);
}

.secondary {
  flex: none;
  padding: 11px 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

.secondary:hover {
  background: var(--ink);
  color: var(--white);
}

.secondary-link {
  margin-left: var(--space-4);
  color: var(--ink);
}

.link-btn,
.linklike {
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.link-btn {
  color: var(--accent);
  border-bottom: 1.5px solid currentcolor;
  text-decoration: none;
}

.linklike {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
}

.linklike:hover {
  color: var(--accent);
}

/* A row of actions at the end of a page or form. */
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-5);
  margin-top: var(--space-9);
}

/* Form controls */
input:is([type="text"], [type="password"], [type="url"]),
textarea,
select {
  width: 100%;
  padding: 13px var(--space-4);
  font: var(--text-base) / 1.5 var(--font-text);
  color: var(--text);
  background: var(--surface);
  border: var(--rule-strong);
  border-radius: 0;
}

:is(input, textarea)::placeholder {
  color: var(--faint);
}

:is(input, textarea, select):hover {
  border-color: var(--link);
}

:is(input, textarea, select):focus {
  outline: none;
  border-color: var(--link);
  box-shadow: inset 0 0 0 1px var(--link);
}

textarea {
  min-height: 128px;
  resize: vertical;
}

select {
  appearance: none;
  padding-right: 44px;
  background: var(--surface) var(--icon-chevron) no-repeat right var(--space-4)
    center / 13px;
  cursor: pointer;
}

.mono-input {
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
}

fieldset {
  min-width: 0;
  margin: var(--space-6) 0 0;
  padding: 0;
  border: 0;
}

.field {
  display: block;
  margin-top: var(--space-5);
}

.field-row {
  display: grid;
  gap: var(--space-5);
  margin-top: var(--space-6);
}

.field-row .field {
  margin-top: 0;
}

.stack-form {
  max-width: 680px;
  margin-top: var(--space-2);
}

/* Panels: a block set apart with an edge in its --tone colour. */
.caution,
.origin-box,
.notice-bar {
  border-left: var(--accent-edge) solid var(--tone);
}

.caution {
  --tone: var(--accent);

  margin-top: var(--space-5);
  padding: var(--space-5);
  background: var(--surface-sunk);
}

.caution p {
  margin: 0;
  max-width: 90ch;
  line-height: 1.6;
  color: var(--text-muted);
}

.caution strong {
  color: var(--text);
  font-weight: 600;
}

.caution + .actions {
  margin-top: var(--space-7);
}

/* Something to copy or keep (a recovery code, an invite). */
.recovery {
  max-width: var(--panel-width);
  margin: var(--space-4) 0 var(--space-5);
  padding: var(--space-4) var(--space-5);
  border: 2px dashed var(--tone, var(--ink));
}

.recovery-code {
  margin: 0 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
  user-select: all;
}

/* 4. Site frame ------------------------------------------------------------ */

.page {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: var(--space-8) clamp(20px, 5vw, 72px) var(--space-9);
}

/* The coloured bar on every page: your node (jade), a shared commons
   (violet) or a practice commons (blue), so nobody confuses them. */
.role-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 20px;
  font-size: var(--text-2xs);
  line-height: 1;
  color: var(--white);
  background: var(--tone);
}

.role-node {
  --tone: var(--jade-ink);
}

.role-commons {
  --tone: var(--violet);
}

.role-practice {
  --tone: var(--blue);
}

.role-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentcolor;
}

.role-instance,
.role-address {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.role-instance {
  opacity: 0.85;
}

.role-address,
.role-link {
  margin-left: auto;
}

.role-address code {
  padding: 3px 6px;
  font-size: var(--text-xs);
  font-weight: 700;
  background: rgb(255 255 255 / 18%);
  user-select: all;
}

.role-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgb(255 255 255 / 70%);
}

.role-link:hover {
  border-bottom-color: currentcolor;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-5);
}

.wordmark {
  display: block;
  text-decoration: none;
}

/* The logo, at the height heldincommon.org uses. */
.wordmark-logo {
  display: block;
  width: auto;
  height: var(--logo-height);
}

.dot {
  color: var(--accent);
}

.topbar-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
}

.topbar-links a,
.topbar-links button {
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.topbar-links a:hover {
  color: var(--accent);
}

.inline-form {
  display: inline;
  margin: 0;
}

/* News for the member, e.g. "now listed on …". */
.notice-bar {
  --tone: var(--jade-ink);

  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin: var(--space-4) 0 var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--jade-wash);
}

.notice-bar p {
  margin: 2px 0;
  font-size: var(--text-md);
}

.notice-bar form {
  margin: 0;
}

.site-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-9);
  padding-top: var(--space-5);
  border-top: var(--rule);
  font: var(--text-xs) var(--font-mono);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: rgb(17 17 17 / 60%);
}

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

.site-foot a:hover {
  color: var(--accent);
}

/* 5. Page parts ------------------------------------------------------------ */

/* Page heading and lede */
.intro h1 {
  margin: var(--space-7) 0 var(--space-4);
  font: 700 var(--text-display) / 1 var(--font-mono);
  letter-spacing: -0.03em;
  word-spacing: -0.12em;
}

.lede {
  max-width: 42ch;
  margin: 0;
  font: italic 500 var(--text-lede) / 1.35 var(--font-serif);
}

.empty-note {
  font: italic 500 var(--text-xl) var(--font-serif);
  color: var(--text-muted);
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.prose {
  max-width: var(--measure);
  margin-top: var(--space-4);
}

.prose h2 {
  margin-top: var(--space-6);
}

.prose p {
  font-size: var(--text-lg);
  line-height: 1.65;
}

/* Reach: who can see a profile. Each reach has a --tone. */
.vis-public {
  --tone: var(--pink);
}

.vis-commons {
  --tone: var(--blue);
}

.vis-members {
  --tone: var(--ink);
}

.vis-federated {
  --tone: var(--violet);
}

.vis-badge {
  align-self: flex-start;
  margin-top: var(--space-2);
  padding: 3px var(--space-3);
  font-size: var(--text-2xs);
  color: var(--white);
  background: var(--tone);
}

/* Directory */
.dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-7);
}

.dir-card {
  display: flex;
  flex-direction: column;
  border: var(--rule);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.dir-card:hover {
  box-shadow: inset 0 0 0 1px var(--ink);
}

.dir-bar {
  height: var(--space-2);
  background: var(--tone, var(--gray));
}

.dir-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--space-5);
}

.dir-avatar {
  display: block;
  width: 46px;
  height: 46px;
  margin-bottom: var(--space-3);
  object-fit: cover;
  border: var(--rule);
}

.dir-name {
  font: 700 var(--text-xl) / 1.2 var(--font-text);
  letter-spacing: -0.01em;
}

.dir-handle {
  font: var(--text-sm) var(--font-mono);
  color: var(--text-muted);
}

.dir-role {
  margin-top: var(--space-1);
  font-size: var(--text-md);
}

.dir-role.locked {
  font: italic 500 var(--text-base) var(--font-serif);
  color: var(--text-muted);
}

/* Where a shared-in card came from: as prominent as the name, so two cards
   with the same display name still differ by origin and signing key. */
.dir-origin {
  margin-top: var(--space-3);
  font: 700 0.8125rem var(--font-mono);
  color: var(--violet-ink);
  overflow-wrap: anywhere;
}

.dir-key {
  margin-top: 2px;
  font: var(--text-2xs) var(--font-mono);
  color: var(--text-muted);
}

/* People waiting for a vouch, and the steward's tools */
.pending {
  margin-top: var(--space-7);
}

.pending-list {
  padding-left: var(--space-4);
}

.pending-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-1) 0;
  padding: 6px 0;
  border-bottom: var(--rule-soft);
}

.steward {
  --tone: var(--violet);
}

.steward-hint {
  margin: 0 0 var(--space-4);
}

/* The commons' "run a node to join" page */
.gate {
  max-width: var(--panel-width);
  margin-top: var(--space-7);
  padding: var(--space-6);
  border: var(--rule);
}

.gate h2 {
  margin: 0 0 20px;
  font: 600 0.9375rem var(--font-mono);
  letter-spacing: var(--track);
  text-transform: uppercase;
}

.gate-steps {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding-left: 1.3em;
  font-size: var(--text-lg);
}

.gate-steps strong {
  font-weight: 600;
}

.gate .actions {
  margin-top: var(--space-6);
}

/* Sign-up: the @ in front of the handle box */
.handle-input {
  display: flex;
  align-items: center;
  border: var(--rule-strong);
}

.handle-input .at {
  padding: 0 var(--space-3);
  font: 700 var(--text-lg) var(--font-mono);
  color: var(--text-muted);
}

.handle-input input,
.handle-input input:focus {
  border: 0;
  box-shadow: none;
}

/* The show/hide button inside passphrase boxes (static/password.js) */
.pw-wrap {
  position: relative;
  display: block;
}

.pw-wrap input {
  padding-right: 48px;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: var(--space-2);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  transform: translateY(-50%);
}

.pw-toggle:hover,
.pw-toggle[aria-pressed="true"] {
  color: var(--text);
}

/* Publish form */
.name-row {
  grid-template-columns: 2fr 1fr;
}

.city-input {
  margin-top: var(--space-3);
}

.photo-field {
  display: flex;
  align-items: flex-start;
  gap: var(--space-6);
}

.photo-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
}

.photo-pick input[type="file"] {
  font: var(--text-sm) var(--font-mono);
}

.avatar-preview {
  display: block;
  flex: none;
  width: 104px;
  height: 104px;
  object-fit: cover;
  border: var(--rule-strong);
  background: var(--surface);
}

.avatar-preview.empty {
  border-style: dashed;
  background: repeating-linear-gradient(
    45deg,
    var(--cream) 0 7px,
    var(--cream-deep) 7px 14px
  );
}

/* A profile */
.profile-places {
  margin-top: var(--space-6);
}

.profile-places ul {
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}

.profile-places li {
  padding: 6px 0;
  border-bottom: var(--rule-soft);
}

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

.profile-meta {
  margin-top: var(--space-7);
  padding-top: 20px;
  border-top: var(--rule);
}

.cid {
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.cid .mono,
.origin-key .mono {
  color: var(--text);
}

/* A profile shared in from another node: where it came from */
.origin-box {
  --tone: var(--violet);

  margin: 0 0 var(--space-3);
  padding: var(--space-3) 0 var(--space-3) var(--space-4);
}

.origin-line {
  margin: 0;
  overflow-wrap: anywhere;
}

.origin-line a {
  font-weight: 700;
}

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

.origin-key {
  margin: 6px 0 0;
  font-size: var(--text-sm);
}

.origin-note {
  max-width: 60ch;
  margin: var(--space-2) 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* A member's own tools: the content of a profile tab (the tabs above
   already set it apart). */
.owner-panel {
  margin-top: var(--space-2);
}

.share-panel,
.share-form {
  max-width: var(--panel-width);
  margin-top: var(--space-6);
}

.share-row {
  display: flex;
  align-items: stretch;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.share-row > input,
.share-row > .pw-wrap {
  flex: 1;
}

.add-commons {
  margin-top: var(--space-4);
}

.add-commons summary {
  color: var(--text-muted);
  cursor: pointer;
}

.add-commons summary:hover {
  color: var(--text);
}

.add-commons .share-form {
  margin-top: var(--space-3);
}

/* Lists of commons: one row each, its name then its buttons */
.commons-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: var(--space-4) 0 0;
  padding: 0;
  list-style: none;
}

.commons-share,
.commons-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.commons-share {
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--line);
}

.commons-row {
  flex-wrap: wrap;
  justify-content: space-between;
}

.commons-meta {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: var(--space-3);
  min-width: 0;
}

.commons-name {
  overflow: hidden;
  font: var(--text-sm) var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commons-status {
  flex: none;
  font-size: var(--text-2xs);
  color: var(--jade-ink);
}

.commons-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.commons-actions form {
  margin: 0;
}

/* Vouch form: labelled fields that sit side by side, each wide enough */
.vouch-form .field {
  margin-top: var(--space-3);
}

.vouch-row {
  grid-template-columns: 1fr 1fr;
  margin-top: var(--space-3);
}

.vouch-form .actions {
  margin-top: var(--space-4);
}

/* Run your own commons: the "try it" panel */
.try-commons {
  --tone: var(--blue);
}

.try-commons .commons-actions {
  align-items: center;
  margin: var(--space-4) 0 0;
}

/* Ramp: the member's next step and tabs (decision record 0022) */

/* Buttons from heldincommon.org: ink, outline, and the pair used on a pink
   block (white, and white outline). */
:where(.btn-ink, .btn-line, .btn-solid, .btn-outline) {
  display: inline-block;
  padding: 14px 20px;
  border: 0;
  border-radius: 0;
  font: 700 var(--text-xs) var(--font-mono);
  letter-spacing: var(--track);
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.btn-ink {
  background: var(--ink);
  color: var(--white);
}

.btn-ink:hover {
  background: var(--accent);
}

.btn-line {
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

.btn-line:hover {
  color: var(--accent);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.btn-solid {
  background: var(--white);
  color: var(--pink);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  box-shadow: inset 0 0 0 1.5px var(--white);
}

/* The one next step: the site's pink call-to-action block. */
.next-step {
  margin: var(--space-4) 0 var(--space-7);
  padding: var(--space-7) clamp(20px, 4vw, 52px);
  background: var(--pink);
  color: var(--white);
}

.next-step-label,
.status-label,
.flash-label {
  margin: 0 0 var(--space-3);
  font: 700 var(--text-xs) var(--font-mono);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
}

.next-step h2 {
  max-width: 20ch;
  margin: 0;
  font: 700 clamp(1.75rem, 4vw, 2.75rem) / 1.05 var(--font-mono);
  letter-spacing: -0.02em;
}

.next-step-lede {
  max-width: 44ch;
  margin: var(--space-4) 0 0;
  font: italic 500 var(--text-lede) / 1.35 var(--font-serif);
}

.next-step-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.next-step-actions form {
  margin: 0;
}

.next-step-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.next-step-form .field-label {
  flex-basis: 100%;
  margin: 0;
  color: inherit;
}

.next-step-form input {
  width: auto;
  min-width: 14rem;
  border: 0;
}

/* Waiting to be listed: a status, not an action (blue bar). */
.status-block {
  margin: var(--space-4) 0 var(--space-7);
  padding: var(--space-6);
  border-top: 8px solid var(--blue);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.status-label {
  color: var(--blue);
}

.status-block h2 {
  margin: 0 0 var(--space-3);
  font: 700 var(--text-xl) var(--font-mono);
}

.cmd {
  padding: var(--space-3) var(--space-4);
  background: var(--ink);
  color: var(--white);
  font: var(--text-sm) / 1.5 var(--font-mono);
  overflow-wrap: anywhere;
  user-select: all;
}

/* Tabs: the site's navigation links, the current one underlined in pink. */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  margin: var(--space-6) 0 var(--space-6);
  padding-bottom: var(--space-3);
  border-bottom: var(--rule);
  font: var(--text-sm) var(--font-mono);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
}

.tab {
  padding-bottom: 3px;
  color: var(--ink);
  text-decoration: none;
  opacity: 0.65;
}

.tab:hover {
  color: var(--accent);
  opacity: 1;
}

.tab[aria-current="page"] {
  border-bottom: 2px solid var(--accent);
  opacity: 1;
}

/* Licence cards: what each licence allows, in plain words. */
.license-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.license-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--ink);
  cursor: pointer;
}

.license-card:has(input:checked) {
  background: var(--ink);
  color: var(--white);
}

.license-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.license-name {
  font: 700 var(--text-base) var(--font-mono);
}

.license-summary {
  font-size: var(--text-sm);
  line-height: 1.5;
}

.license-facts {
  display: flex;
  flex-direction: column;
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: var(--rule-soft);
  font: var(--text-xs) / 1.7 var(--font-mono);
}

.license-commercial.is-yes {
  color: var(--accent);
}

.license-card:has(input:checked) .license-commercial.is-yes {
  color: var(--white);
}

/* Stories: how it travels, and what just happened */
.flash {
  margin: var(--space-4) 0 var(--space-6);
  padding: var(--space-5);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.flash p {
  margin: 0;
}

.flash-done {
  border-top: 8px solid var(--jade);
}

.flash-done .flash-label {
  color: var(--jade-ink);
}

.flash-withdrawn {
  border-top: 8px solid var(--ink);
}

/* Design pass (decision record 0022): the heldincommon.org look ---------- */

/* The tagline under the logo */
.tagline {
  display: block;
  margin-top: 3px;
  font: var(--text-2xs) var(--font-mono);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.62;
}

/* A page heading's small pink label above the title */
.eyebrow {
  margin: var(--space-7) 0 var(--space-5);
  font: var(--text-xs) var(--font-mono);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow + h1 {
  margin-top: 0;
}

/* A section label followed by a rule across the page */
.section-label {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-8) 0 var(--space-5);
  font: 700 var(--text-xs) var(--font-mono);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
}

.rule-fill {
  flex: 1;
  height: 1px;
  background: var(--ink);
}

.section-aside {
  font-weight: 400;
  color: var(--text-muted);
}

.muted {
  opacity: 0.7;
}

/* The numbered starburst (heldincommon.org's step mark) */
.burst {
  flex: none;
  fill: var(--tone);
}

.burst text {
  font: 700 2.125rem var(--font-mono);
  fill: var(--white);
}

.tone-pink {
  --tone: var(--pink);
}

.tone-blue {
  --tone: var(--blue);
}

.tone-jade {
  --tone: var(--jade-ink);
}

.tone-violet {
  --tone: var(--violet);
}

.tone-ink {
  --tone: var(--ink);
}

/* Sharing and rights: numbered steps of choices. The form uses the page's
   width for its panels; its ordinary fields keep the panel width. */
.rights-form {
  max-width: none;
}

.rights-form .field,
.rights-form .field-row,
.rights-form .caution {
  max-width: var(--panel-width);
}

/* Sharing and rights: numbered steps of choices */
.rights-intro {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: var(--space-5) var(--space-8);
  align-items: start;
}

.rights-intro p {
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.62;
}

.rights-intro .rights-intro-title {
  font: 700 clamp(1.5rem, 2.6vw, 2rem) / 1.2 var(--font-mono);
}

.rights-step {
  min-width: 0;
  margin: var(--space-7) 0 0;
  padding: 0;
  border: 0;
}

.rights-step legend {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: 0;
  font: 600 1.75rem / 1.1 var(--font-serif);
}

/* One panel of choices split by thin rules; the chosen one is filled in ink */
.choice-panel {
  display: flex;
  flex-wrap: wrap;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.choice {
  display: flex;
  flex: 1 1 15rem;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-5);
  box-shadow: inset 1px 0 0 var(--line);
  cursor: pointer;
}

.choice:has(input:checked) {
  background: var(--ink);
  color: var(--white);
}

.choice:has(input:focus-visible) {
  outline: var(--focus);
  outline-offset: -4px;
}

.choice-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.choice-head input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.choice-title {
  font: 600 1.5rem / 1.1 var(--font-serif);
}

.choice-body {
  font-size: var(--text-hint);
  line-height: 1.55;
  opacity: 0.8;
}

.choice-facts {
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: 1px solid currentcolor;
  font: var(--text-xs) / 1.7 var(--font-mono);
  white-space: pre-line;
  opacity: 0.8;
}

.choice.is-soon {
  cursor: not-allowed;
  opacity: 0.7;
}

.soon-tag {
  padding: 4px 8px;
  font: 700 var(--text-2xs) var(--font-mono);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.license-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
}

.license-short {
  font: var(--text-xs) var(--font-mono);
  opacity: 0.75;
}

/* What travels with every copy: one panel of three cells */
.terms-panel {
  display: flex;
  flex-wrap: wrap;
  margin: var(--space-4) 0;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.terms-cell {
  flex: 1 1 9rem;
  padding: var(--space-4) var(--space-5);
  box-shadow: inset 1px 0 0 var(--line);
}

.terms-cell p {
  margin: 0;
}

.terms-cell .terms-label {
  margin-bottom: var(--space-1);
  font: var(--text-2xs) var(--font-mono);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}

.terms-value {
  font: 700 var(--text-sm) var(--font-mono);
}

/* Story cards */
.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr));
  gap: var(--space-4);
}

.story-card,
.share-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.card-bar {
  flex: none;
  height: 8px;
  background: var(--tone, var(--violet));
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
}

.card-body p {
  margin: 0;
}

.card-label {
  font: 700 var(--text-2xs) var(--font-mono);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}

.card-title {
  margin: 0;
  font: 600 1.625rem / 1.1 var(--font-serif);
}

.card-title a {
  color: var(--ink);
  text-decoration: none;
}

.card-title a:hover {
  color: var(--accent);
}

.card-first {
  font: italic 500 var(--text-lg) / 1.4 var(--font-serif);
  opacity: 0.85;
}

.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-3);
  border-top: var(--rule-soft);
  font: var(--text-2xs) var(--font-mono);
  letter-spacing: var(--track);
  text-transform: uppercase;
}

.card-foot-end {
  margin-left: auto;
}

.story-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Chips as in heldincommon.org's model explorer: mono, outlined, and (when
   they do something) lifting onto a hard ink shadow under the pointer. */
.story-chip {
  padding: 7px 11px;
  font: var(--text-xs) var(--font-mono);
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}

/* On your own stories the chips open the rights step. */
.story-chips.is-editable {
  text-decoration: none;
}

.story-chips.is-editable .story-chip {
  cursor: pointer;
}

.story-chips.is-editable .story-chip:hover,
.story-chips.is-editable:focus-visible .story-chip {
  box-shadow:
    inset 0 0 0 1px var(--ink),
    4px 4px 0 var(--ink);
  transform: translate(-2px, -2px);
}

.story-chips.is-editable:focus-visible {
  outline: var(--focus);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .story-chip {
    transition: none;
  }
}

.verified {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--jade-ink);
}

.verified svg {
  fill: none;
  stroke: currentcolor;
  stroke-width: 3;
}

.story-card.is-withdrawn {
  --tone: var(--line);

  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--text-muted);
}

/* One story: the story, and a side panel */
.story-layout {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-7) var(--space-8);
  align-items: flex-start;
}

.story-main {
  flex: 1 1 32rem;
  min-width: 0;
}

.story-title {
  margin: 0;
  font: 700 clamp(2.25rem, 6vw, 4.25rem) / 1 var(--font-mono);
  letter-spacing: -0.03em;
  word-spacing: -0.16em;
}

.story-title::after {
  content: ".";
  color: var(--accent);
}

.story-meta {
  margin: var(--space-3) 0 0;
  font: var(--text-xs) var(--font-mono);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--text-muted);
}

.story-text {
  max-width: 40ch;
  margin-top: var(--space-6);
  font: 500 1.5rem / 1.6 var(--font-serif);
}

.story-side {
  display: flex;
  flex: 1 1 20rem;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.story-side .terms-panel {
  margin: 0;
}

.story-side .terms-cell {
  flex-basis: 6.5rem;
  padding: var(--space-3) var(--space-4);
}

.share-card {
  --tone: var(--violet);
}

.share-card.is-new {
  --tone: var(--jade);
}

.share-host {
  font: 700 var(--text-base) var(--font-mono);
  overflow-wrap: anywhere;
}

.share-when {
  font: var(--text-xs) var(--font-mono);
  color: var(--text-muted);
}

.share-when.is-stale {
  color: var(--accent);
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.share-actions form {
  margin: 0;
}

.side-note {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.side-note p {
  margin: 0;
}

/* Writing a story */
.write-form .write-title {
  font: 700 1.25rem var(--font-mono);
}

.write-form .write-text {
  font: 500 1.375rem / 1.55 var(--font-serif);
}

/* A profile's header: square photo, terms, name, handle, bio */
.profile-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  align-items: flex-start;
  margin-top: var(--space-6);
}

.profile-photo {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 12.5rem;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--cream);
  box-shadow: inset 0 0 0 1px var(--ink);
  font: 700 4rem var(--font-mono);
  color: var(--text-muted);
}

.profile-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info {
  display: flex;
  flex: 1 1 22rem;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.profile-info p {
  margin: 0;
}

.profile-terms {
  font: 700 var(--text-2xs) var(--font-mono);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--accent);
}

.profile-name {
  margin: 0;
  font: 700 clamp(2.125rem, 5vw, 3.5rem) / 1 var(--font-mono);
  letter-spacing: -0.03em;
}

.profile-name::after {
  content: ".";
  color: var(--accent);
}

.profile-handle {
  font: var(--text-xs) var(--font-mono);
  letter-spacing: var(--track);
  text-transform: uppercase;
  color: var(--text-muted);
}

.profile-info .profile-lead {
  max-width: 42ch;
  margin-top: var(--space-3);
  font: italic 500 var(--text-lede) / 1.35 var(--font-serif);
  white-space: pre-line;
}

/* The Account tab: cards for backup, recovery key and your key */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-4);
}

.account-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.account-card p {
  margin: 0;
}

.account-card.is-ink {
  background: var(--ink);
  color: var(--white);
}

.account-card.is-ink .card-label {
  color: inherit;
  opacity: 0.65;
}

.key-value {
  font: 700 1.25rem var(--font-mono);
  overflow-wrap: anywhere;
  user-select: all;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: auto;
}

.account-form .btn-line {
  align-self: flex-start;
}

.advanced {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: var(--rule-soft);
}

.advanced summary {
  font: 700 var(--text-xs) var(--font-mono);
  letter-spacing: var(--track);
  text-transform: uppercase;
  cursor: pointer;
}

.account-signout {
  margin-top: var(--space-6);
}

/* 6. Small screens --------------------------------------------------------- */

@media (max-width: 640px) {
  .name-row,
  .vouch-row {
    grid-template-columns: 1fr;
  }

  .photo-field {
    flex-direction: column;
    gap: var(--space-4);
  }

  .reach {
    gap: var(--space-3);
    padding: 20px var(--space-4);
  }
}
