/* Компоненти: кнопки, поля, записи, марки, хедер, футер, тости, вкладки. */
/* Components. Square corners, hairline frames, depth from surface color only (no bevels).
   The accent (terracotta) marks the one primary action; green belongs to proof only. */

/* ---------- Icon ---------- */

.icon {
  display: inline-block;
  width: var(--icon-m);
  height: var(--icon-m);
  vertical-align: middle;
}

.icon * { vector-effect: non-scaling-stroke; }

/* Small arrow after a label ("Explore projects ↗"). Moves 2px toward its direction on hover. */
.arrow {
  width: 0.875rem;
  height: 0.875rem;
  transition: transform var(--t-base) var(--ease-out);
}

@media (hover: hover) {
  :is(a, button):hover > .arrow { transform: translate(2px, -2px); }
}

/* ---------- Buttons ---------- */

/* Each variant sets three values: --btn-bg (fill), --btn-fg (label) and --btn-edge (border). States change only
   those, so hover, press, focus, disabled and loading look the same on every variant.
   Sizes: default 44px (--control-h), .btn--lg 52px; .btn--icon is a 44px square. Radius: --radius-btn (10px). */

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-edge: transparent; /* transparent edges still show in forced-colors mode */
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--control-h);
  padding: 0 var(--btn-pad);
  border: 1px solid var(--btn-edge);
  border-radius: var(--radius-btn);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: transform var(--t-fast) var(--ease-press);
}

.btn:active { transform: scale(0.98); }

.btn--lg {
  min-height: var(--control-h-lg);
  padding-inline: var(--btn-pad-lg);
}

/* The arrow sits at the right edge of wide buttons, like the hero action in the sketches. */
.btn--lg .arrow { margin-left: var(--s-3); }

.btn--primary { --btn-bg: var(--accent); --btn-fg: var(--on-accent); --btn-edge: var(--focus-edge); }
.btn--secondary { --btn-bg: var(--surface); --btn-fg: var(--text); --btn-edge: var(--line-strong); }
.btn--quiet { padding-inline: var(--s-3); }
.btn--danger { --btn-fg: var(--danger); --btn-edge: var(--danger); }

/* Filled danger: only for the final confirmation of a destructive action. */
.btn--danger-solid { --btn-bg: var(--danger); --btn-fg: var(--on-danger); --btn-edge: var(--danger); }

@media (hover: hover) {
  .btn--primary:hover { --btn-bg: var(--accent-hover); --btn-edge: var(--focus-edge); }
  .btn--secondary:hover { --btn-edge: var(--text); }
  .btn--quiet:hover { --btn-bg: var(--tint); }
  .btn--danger:hover { --btn-bg: var(--danger-tint); }
  .btn--danger-solid:hover { --btn-bg: var(--danger-hover); --btn-edge: var(--danger-hover); }
}

/* Press: a small scale (above) plus the hover colour, so touch screens get an answer too. */
.btn--primary:active { --btn-bg: var(--accent-hover); --btn-edge: var(--focus-edge); }
.btn--secondary:active { --btn-bg: var(--tint); --btn-edge: var(--text); }
.btn--quiet:active { --btn-bg: var(--tint); }

/* Focus follows the rounded corners (outline does, in current browsers). */
.btn:focus-visible { outline-offset: 3px; }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 1;
  cursor: not-allowed;
  transform: none;
}

/* Loading: aria-busy="true" (any script) blocks further clicks. busy.js also sets data-busy-ring on the button
   that submitted a normal form: the label turns transparent and a ring turns in its place, so the button keeps its
   size. Scripts with their own busy text (domain check) and like/follow (optimistic) keep their label. */
.btn[aria-busy="true"] { cursor: progress; pointer-events: none; }

.btn[data-busy-ring]:not(.btn--halo) { color: transparent; }

.btn[data-busy-ring]:not(.btn--halo)::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.125rem;
  height: 1.125rem;
  margin: -0.5625rem 0 0 -0.5625rem;
  border: 2px solid var(--btn-fg);
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 700ms linear 1;
}

@keyframes btn-spin { to { transform: rotate(1turn); } }

/* Reduced motion: the ring stands still (base.css stops it); the transparent label still says "busy". */

.btn--icon {
  width: var(--control-h);
  padding: 0;
}

.btn--block { width: 100%; }

/* ---------- GitHub perimeter light ----------
   An ink track keeps the proof-tinted (light) / signal (dark) sweep visible.
   Only transform and opacity animate; hover and focus make one 900ms turn. */

.btn--halo {
  --halo-w: 2px;
  --halo-base: var(--halo-track);
  --halo-light: var(--halo-tint);
  --halo-spark: var(--halo-tint);
  isolation: isolate;
  overflow: hidden;
  border: 0;
  background: var(--halo-base);
}

.btn--halo.btn--primary {
  --halo-base: var(--halo-track);
  --halo-spark: var(--halo-tint);
}

.btn--halo::before,
.btn--halo::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.btn--halo::before {
  z-index: -2;
  top: 50%;
  left: 50%;
  width: 200%;
  aspect-ratio: 1;
  background: conic-gradient(from 0deg, var(--halo-base) 0 34%, var(--halo-light) 62%, var(--halo-spark) 79%,
                             var(--halo-light) 90%, var(--halo-base) 100%);
  opacity: 0;
  transform: translate(-50%, -50%) rotate(0deg);
  transition: opacity var(--t-base) var(--ease-out);
}

.btn--halo::after {
  z-index: -1;
  inset: var(--halo-w);
  border-radius: calc(var(--radius-btn) - var(--halo-w));
  background: var(--btn-bg);
  transition: none;
}

.btn--halo:focus-visible::before,
.btn--halo[aria-busy="true"]::before {
  opacity: 1;
  animation: halo-spin 900ms linear 1;
}

@media (hover: hover) {
  .btn--halo:hover::before {
    opacity: 1;
    animation: halo-spin 900ms linear 1;
  }
}

@keyframes halo-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(1turn); }
}

/* Reduced motion: no turning, but the ring still lights up as a static gradient on hover and focus. */
@media (prefers-reduced-motion: reduce) {
  .btn--halo::before { transform: translate(-50%, -50%) rotate(0deg); }
}

@media (forced-colors: active) {
  .btn--halo { border: 1px solid ButtonText; }
  .btn--halo::before,
  .btn--halo::after { display: none; }
}

/* One primary button per page; no markup templates are changed. */
.motion-shimmer {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}
.motion-shimmer::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 18%;
  background: linear-gradient(100deg, transparent, rgb(243 246 247 / 0.5), transparent);
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .js .btn[data-loop] > .motion-shimmer::before {
    animation: primary-shimmer 3.6s linear infinite;
    animation-play-state: paused;
  }
  .js .btn[data-loop].is-inview > .motion-shimmer::before { animation-play-state: running; }
}
@keyframes primary-shimmer {
  0%, 65% { transform: translateX(-110%) skewX(-12deg); opacity: 0; }
  68% { transform: translateX(-110%) skewX(-12deg); opacity: 0.5; }
  94% { transform: translateX(660%) skewX(-12deg); opacity: 0.5; }
  100% { transform: translateX(660%) skewX(-12deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .motion-shimmer::before { animation: none !important; opacity: 0; transform: none; }
  .btn--halo::before { animation: none !important; }
  .btn[data-busy-ring]::after { animation: none !important; transform: none; }
}

/* A text link with an arrow, used for "Explore projects ↗" and similar. */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--control-h);
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.link-arrow > span {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: transparent;
  text-underline-offset: 0.22em;
  transition: none;
}

@media (hover: hover) {
  .link-arrow:hover > span { text-decoration-color: var(--signal); }
}

/* ---------- Fields ---------- */

.field {
  display: grid;
  gap: var(--s-2);
}

.field__label { font-weight: 500; }

.field__hint {
  color: var(--muted);
  font-size: var(--fs--1);
}

.field__error {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  color: var(--danger);
  font-size: var(--fs--1);
}

.field__error .icon {
  width: 1rem;
  height: 1rem;
  margin-top: 0.1em;
}

/* Summary above a form that failed. Focused on load (form-errors.js) so screen readers read it first. */
.form-errors {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--danger);
  border-left-width: 3px;
  background: var(--surface);
}

.form-errors__list { margin: 0; padding-left: var(--s-5); display: grid; gap: var(--s-1); color: var(--danger); font-size: var(--fs--1); }
.form-errors__list a { color: inherit; text-decoration-color: var(--signal); }

.input,
.textarea,
.select {
  display: block;
  width: 100%;
  min-height: var(--control-h);
  padding: 0.5625rem var(--s-3); /* 9px: centres one line of text in the 44px control */
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: max(16px, 1rem); /* 16px minimum stops iOS from zooming in */
  line-height: 1.4;
  appearance: none;
  transition: none;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

@media (hover: hover) {
  .input:hover,
  .textarea:hover,
  .select:hover { border-color: var(--text); }
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--text);
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.input[aria-invalid="true"],
.textarea[aria-invalid="true"],
.select[aria-invalid="true"] {
  border-color: var(--danger);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
  background: var(--tint);
  color: var(--muted);
  cursor: not-allowed;
}

.textarea {
  min-height: 8rem;
  line-height: var(--lh-body);
  resize: vertical;
}

.select-wrap { position: relative; display: block; }

.select { padding-right: var(--control-h); cursor: pointer; } /* room for the chevron */

.select-wrap > .icon {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

/* Checkbox: 20px box inside a row at least 44px tall. */
.check {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  min-height: var(--control-h);
  padding-block: 0.6rem;
  cursor: pointer;
}

.checkbox {
  appearance: none;
  flex: none;
  display: grid;
  place-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.15em 0 0;
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
}

.checkbox::before {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  background: var(--paper);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0);
  transition: transform var(--t-fast) var(--ease-out);
}

.checkbox:checked {
  background: var(--text);
  border-color: var(--text);
}

.checkbox:checked::before { transform: scale(1); }

.checkbox[aria-invalid="true"] { border-color: var(--danger); }

@media (forced-colors: active) {
  .checkbox::before { background: CanvasText; }
}

/* Radio: the round twin of the checkbox (a chosen option is filled with the text color). */
.radio {
  appearance: none;
  flex: none;
  display: grid;
  place-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.15em 0 0;
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  cursor: pointer;
}

.radio::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--paper);
  transform: scale(0);
  transition: transform var(--t-fast) var(--ease-out);
}

.radio:checked { background: var(--text); border-color: var(--text); }
.radio:checked::before { transform: scale(1); }

@media (forced-colors: active) {
  .radio::before { background: CanvasText; }
}

/* A literal value to paste (DNS record, meta tag, embed snippet): mono, selectable in one tap.
   Sits next to a .btn--copy button; the text stays selectable when JS is off. */
.code-value {
  flex: 1 1 14rem;
  min-width: 0;
  padding: var(--s-2) var(--s-3);
  background: var(--paper);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--fs--1);
  line-height: 1.5;
  overflow-wrap: anywhere;
  user-select: all;
  -webkit-user-select: all;
}

.btn--copy { flex: none; gap: var(--s-2); }

/* ---------- Record: a framed surface with a mono header row ---------- */
/* "Shipmark / Project record   № 0042", "Relay / Build log". */

.record {
  background: var(--surface);
  border: 1px solid var(--line);
}

.record__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  padding: var(--s-4) var(--s-5);
}

.record__body { padding: 0 var(--s-5) var(--s-5); }

.record__rule {
  height: 1px;
  margin: var(--s-5) 0;
  border: 0;
  background: var(--line);
}

@media (min-width: 48em) {
  .record__head { padding: var(--s-5) var(--s-5) var(--s-4); }
}

/* ---------- Plate (a project, shown large) ---------- */

.plate {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: var(--s-5);
}

@media (min-width: 48em) {
  .plate--featured { padding: var(--s-6); }
}

.plate__head {
  display: grid;
  gap: var(--s-2);
}

.plate__title {
  font-family: var(--font-display);
  font-size: var(--fs-2);
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
}

.plate--featured .plate__title { font-size: var(--fs-3); }

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

@media (hover: hover) {
  .plate__title a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
}

.plate__tagline {
  color: var(--muted);
  font-size: var(--fs-1);
  line-height: var(--lh-snug);
}

.plate__owner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  color: var(--muted);
  font-size: var(--fs--1);
}

.plate__owner a { color: inherit; }

/* The strip where hallmarks sit. */
.plate__strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-5);
}

.plate__meta {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}

/* "Built with Cursor (self-declared)". */
.declared {
  font-family: var(--font-mono);
  font-size: var(--fs--2);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Project card (grids: landing, explore) ---------- */

.card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 40em) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 64em) {
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-6); }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: none;
}

.card__media,
.mock {
  /* A preview area is a tinted surface (ink mixed into paper), so it reads as an object in the light theme, where
     paper, surface and raised are the same colour. Resolved here so it follows .band and data-theme. */
  --preview-bg: color-mix(in srgb, var(--text) 5%, var(--paper));
}

.card__media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--preview-bg);
  border-bottom: 1px solid var(--line);
}

.card__media > * {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms var(--ease-out);
}

.card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-5);
}

.card__title {
  font-family: var(--font-display);
  font-size: var(--fs-2);
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
}

/* The title link covers the whole card; other links inside sit above it. */
.card__title a {
  color: inherit;
  text-decoration: none;
}

.card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card a:not(.card__title a) { position: relative; z-index: 2; }

.card__tagline { color: var(--muted); }

.card__marks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-1);
}

.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: auto;
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs--1);
}

.card__foot .arrow { color: var(--text); width: 1rem; height: 1rem; }

@media (hover: hover) {
  .card:hover { border-color: var(--line-strong); }
  .card:hover .card__media > * { transform: scale(1.02); }
  .card:hover .card__foot .arrow { transform: translate(2px, -2px); }
}

.card:focus-within { border-color: var(--text); }
.card__title a:focus-visible { outline: none; }
.card:has(.card__title a:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Compact list: rows, not cards ---------- */

.plate-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.plate-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--s-3) var(--s-4);
  padding-block: var(--s-4);
  border-bottom: 1px solid var(--line);
}

/* Phones: the marks get the whole row under the thumbnail and text (in the text column alone, 230px wide at 360,
   they stood one per line). */
.plate-row__marks { grid-column: 1 / -1; }

@media (min-width: 48em) {
  .plate-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .plate-row__marks { grid-column: auto; justify-content: flex-end; }
}

.plate-row__name {
  font-family: var(--font-display);
  font-size: var(--fs-1);
  font-weight: 500;
  line-height: var(--lh-snug);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.plate-row__name a {
  color: var(--text);
  text-decoration: none;
}

@media (hover: hover) {
  .plate-row__name a:hover { text-decoration: underline; }
}

.plate-row__tagline {
  color: var(--muted);
  font-size: var(--fs--1);
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.plate-row__marks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
}

/* Cover in a list row: first screenshot or the first letter of the project name. */
.project-thumb {
  flex: none;
  display: grid;
  place-content: center;
  width: 5rem;
  height: 3.5rem;
  object-fit: cover;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: var(--fs-1);
  font-weight: 500;
}

/* ---------- Badges after a name: official account, moderator (one component) ----------
   The same twelve-point rosette symbol, reference blue for official accounts and red for moderators.
   These two reference colours are deliberately independent of the site palette.
   Hover or focus: a short mono tooltip. Click or tap: the shared panel (.badge-pop, badges.js). The glyph has a
   fixed em size, so nothing moves when it loads; the hit area grows invisibly around it. */

.badge-symbols { position: absolute; width: 0; height: 0; overflow: hidden; }

.user-mark {
  --mark-size: 0.85em;
  position: relative;
  z-index: 2; /* above a card's stretched title link */
  display: inline-grid;
  place-items: center;
  width: var(--mark-size);
  height: var(--mark-size);
  min-width: 14px;
  min-height: 14px;
  margin: 0;
  margin-inline-start: 0.3em;
  padding: 0;
  vertical-align: -0.1em;
  background: none;
  border: 0;
  border-radius: 2px;
  color: var(--text);
  line-height: 0;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out);
}

.user-mark--s { --mark-size: 0.8em; }
.user-mark--l { --mark-size: 0.7em; }
.user-mark--moderator { color: var(--muted); }
.user-mark .icon { width: 100%; height: 100%; }

.user-mark::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
  transform: translate(-50%, -50%);
}

.user-mark:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.user-mark:active { transform: scale(0.92); }
@media (hover: hover) { .user-mark:hover { transform: scale(1.08); } }

/* Tooltip: the badge's own label. Physical left + translateX keeps it centred in both directions (RTL too). */
.user-mark::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  padding: var(--s-1) var(--s-2);
  background: var(--text);
  color: var(--paper);
  font: 400 var(--fs--2) / 1.4 var(--font-mono);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity var(--t-fast), transform var(--t-fast) var(--ease-out);
}
.user-mark:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
@media (hover: hover) { .user-mark:hover::after { opacity: 1; transform: translate(-50%, 0); } }
.user-mark[aria-expanded="true"]::after { opacity: 0; }

/* The panel: a popover next to the badge (position from badges.js), a bottom sheet under 48em. */
.badge-pop {
  position: fixed;
  z-index: 60;
  top: var(--pop-y, 1rem);
  left: var(--pop-x, 1rem);
  display: grid;
  width: min(20rem, calc(100vw - 1rem));
  padding: var(--s-5);
  padding-inline-end: var(--s-8);
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop);
}
.badge-pop[hidden] { display: none; }
.badge-pop:focus { outline: none; }
.badge-pop:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.badge-pop.is-sheet {
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  width: auto;
  padding-bottom: calc(var(--s-5) + env(safe-area-inset-bottom));
  border-width: 1px 0 0;
}
.badge-pop__close { position: absolute; top: var(--s-2); inset-inline-end: var(--s-2); }
.badge-pop__body { display: grid; gap: var(--s-3); }
.badge-pop__head { display: flex; align-items: center; gap: var(--s-2); }
.badge-pop__glyph { display: inline-grid; width: 1.5rem; height: 1.5rem; flex: none; color: var(--text); }
.badge-pop__glyph--moderator { color: var(--muted); }
.badge-pop__glyph .icon { width: 100%; height: 100%; }
.badge-pop__title { margin: 0; font-size: var(--fs-1); }
.badge-pop__text { display: flex; align-items: flex-start; gap: var(--s-2); margin: 0; }
.badge-pop__facts {
  display: grid;
  gap: var(--s-2);
  margin: 0;
  padding: var(--s-3) 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs--1);
  list-style: none;
}
.badge-pop__facts li { display: flex; align-items: center; gap: var(--s-2); }
.badge-pop__facts li[hidden] { display: none; }
.badge-pop__facts .icon,
.badge-pop__logo { width: 1rem; height: 1rem; flex: none; color: var(--text); }
.badge-pop__more { justify-self: start; }

@media (prefers-reduced-motion: no-preference) {
  .badge-pop.is-open { animation: badge-pop-in 160ms var(--ease-out); }
  .badge-pop.is-open.is-sheet { animation: badge-sheet-in 220ms var(--ease-out); }
}
@keyframes badge-pop-in { from { opacity: 0; transform: translateY(4px) scale(0.98); } }
@keyframes badge-sheet-in { from { transform: translateY(100%); } }

/* ---------- Moderation notices (mute, decisions) and the "Moderate" menu ---------- */
/* A notice is a framed record with a danger rule on the left for sanctions (it limits what you can do). */

.account-notices { display: grid; gap: var(--s-3); margin-block: var(--s-4); }

.notice {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line-strong);
}

.notice p { margin: 0; }
.notice__title { font-weight: 500; }
.notice--sanction { border-left: 3px solid var(--danger); }
.notice form { justify-self: start; }

.mod-menu { position: relative; display: inline-block; }
.mod-menu__button { list-style: none; }
.mod-menu__button::-webkit-details-marker { display: none; }
.mod-menu__panel {
  position: absolute;
  z-index: 20;
  right: 0;
  top: calc(100% + var(--s-1));
  min-width: 16rem;
  margin: 0;
  padding: var(--s-2) 0;
  list-style: none;
  background: var(--raised);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
}
.mod-menu[open] .mod-menu__panel { animation: menu-in var(--t-base) var(--ease-out); }

/* ---------- Hallmark: a flat stamped chip, "✓ Repo owner" ---------- */
/* Earned: pale green fill, green mono label, a check. Not earned: dashed outline, muted, "Not yet".
   Names stay English in every language (see docs/EDITING.md), so chips keep one width. */

.hallmark {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-3);
  vertical-align: middle;
}

.hallmark__chip {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 1.75rem;
  padding: 0 var(--chip-pad) 0 var(--s-2);
  border: 1px solid transparent;
  color: var(--proof);
  font-family: var(--font-mono);
  font-size: var(--fs--2);
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* The fill is its own layer so the strike can press it in with transform and opacity only. */
.hallmark__chip::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  background: var(--proof-bg);
}

.hallmark__glyph {
  width: 0.875rem;
  height: 0.875rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: square;
}

.hallmark--s .hallmark__chip { min-height: 1.5rem; padding: 0 var(--s-2) 0 0.375rem; gap: var(--s-1); }
.hallmark--s .hallmark__glyph { width: 0.75rem; height: 0.75rem; }

.hallmark--l .hallmark__chip { min-height: 2rem; padding: 0 0.875rem 0 0.625rem; font-size: var(--fs--1); }
.hallmark--l .hallmark__glyph { width: 1rem; height: 1rem; }

.is-unearned .hallmark__chip {
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}

.is-unearned .hallmark__chip::before { content: none; }

.hallmark__state {
  color: var(--muted);
}

.hallmark__state::before { content: "· "; content: "· " / ""; } /* decorative: not read aloud */

.hallmark__fact {
  color: var(--muted);
  font-size: var(--fs--1);
  line-height: var(--lh-snug);
}

/* L: the fact goes under the chip. */
.hallmark--l {
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-2);
}

@media (forced-colors: active) {
  .hallmark__chip { border: 1px solid CanvasText; }
  .is-unearned .hallmark__chip { border-style: dashed; }
}

/* ---------- Proof note: "↳ Marks are never permanent." ---------- */

.proof-note {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  background: var(--proof-bg);
  color: var(--proof);
  font-family: var(--font-mono);
  font-size: var(--fs--2);
  line-height: 1.6;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.proof-note .icon { width: var(--icon-s); height: var(--icon-s); margin-top: 0.05em; }

/* ---------- Band: a dark strip for statements. Uses the dark tokens in both themes. ---------- */

.band {
  --paper: var(--band-bg);
  background: var(--band-bg);
  color: var(--text);
}

/* ---------- Section head: eyebrow, headline, lede, and an optional link on the right ---------- */

.section-head {
  display: grid;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}

.section-head h2 { max-width: 20ch; }

@media (min-width: 48em) {
  .section-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: var(--s-4) var(--s-6);
    margin-bottom: var(--s-7);
  }
  .section-head > :not(.section-head__aside) { grid-column: 1; }
  .section-head__aside { grid-column: 2; grid-row: 2 / span 2; align-self: end; }
}

/* Hairline that can draw itself in (motion.css). */
.rule {
  height: 1px;
  margin: 0;
  border: 0;
  background: var(--line);
  transform-origin: left center;
}

/* ---------- Tag chip ---------- */

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 var(--chip-pad);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs--2);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: none;
}

/* Visible chip is 32px; the tap area is 44px (the row gap leaves room for it). */
a.chip::after {
  content: "";
  position: absolute;
  inset: -6px 0;
}

@media (hover: hover) {
  a.chip:hover {
    color: var(--text);
    border-color: var(--line-strong);
  }
}

.chip[aria-current="true"],
.chip[aria-current="page"] {
  color: var(--paper);
  background: var(--text);
  border-color: var(--text);
}

/* File input: the browser's button styled like our secondary button. */
.input--file { padding: var(--s-2); cursor: pointer; }

.input--file::file-selector-button {
  min-height: 2.5rem;
  margin-right: var(--s-3);
  padding: 0 var(--s-3);
  background: var(--paper);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn); /* a button: same corners as .btn */
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: none;
}

@media (hover: hover) {
  .input--file:hover::file-selector-button { border-color: var(--text); }
}

/* A small flat label, not proof green and not the action colour: it is a statement by the person. */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 1.75rem;
  padding: 0 0.6em;
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs--2);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

.status-chip::before { content: ""; width: 6px; height: 6px; background: currentColor; }

/* ---------- Avatar (people are round) ---------- */

.avatar {
  --size: 2rem;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.avatar--24 { --size: 1.5rem; }
.avatar--32 { --size: 2rem; }
.avatar--48 { --size: 3rem; }
.avatar--96 { --size: 6rem; }
.avatar--128 { --size: 8rem; }

.avatar--initials {
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  font-size: calc(var(--size) * 0.4);
  font-weight: 600;
  line-height: 1;
  user-select: none;
}

/* ---------- Site header ---------- */

.site-header {
  position: relative;
  z-index: 40;
  background: var(--paper);
  padding-top: env(safe-area-inset-top);
  view-transition-name: site-header;
}

.site-header__inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: 4rem;
}

/* The hairline spans the content width, not the window (as in the sketches). */
.site-header__inner::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: max(var(--pad), env(safe-area-inset-left));
  right: max(var(--pad), env(safe-area-inset-right));
  height: 1px;
  background: var(--line);
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  margin-right: auto;
  color: var(--text);
}

.site-logo {
  display: block;
  width: auto;
  height: 1.5rem;
}

.site-logo .logo-mark,
.site-logo .logo-word { fill: currentColor; }


.site-nav__list {
  display: flex;
  gap: var(--s-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  padding: 0 var(--s-3);
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap; /* "For You", "Für dich": a label never breaks over two lines */
  transition: none;
}

/* Current page: text color and a short bar under the word. */
.site-nav__link::after {
  content: "";
  position: absolute;
  left: var(--s-3);
  right: var(--s-3);
  bottom: 0.45rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--t-base) var(--ease-out);
}

.site-nav__link[aria-current="page"] { color: var(--text); }

/* The current page's bar is an element (.tab-mark), not the ::after, so a page-to-page view transition can slide it to
   the next link (motion.css). Same place and look as the hover bar. The phone menu marks the page with ::before. */
.site-nav__link .tab-mark {
  left: var(--s-3);
  right: var(--s-3);
  bottom: 0.45rem;
  height: 1px;
}

@media (hover: hover) {
  .site-nav__link:hover { color: var(--text); }
  .site-nav__link:hover::after { transform: scaleX(1); }
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

/* Desktop parts are hidden on phones; the <details> menu is hidden on desktop. */
.site-header__bar { display: none; }

.site-menu > summary {
  list-style: none;
}

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

.site-menu__open,
.site-menu__shut {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}

.site-menu[open] .site-menu__open,
.site-menu:not([open]) .site-menu__shut {
  display: none;
}

.site-menu__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  padding: var(--s-2) max(var(--pad), env(safe-area-inset-right)) var(--s-5) max(var(--pad), env(safe-area-inset-left));
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
}

.site-menu[open] .site-menu__panel { animation: menu-in var(--t-base) var(--ease-out); }

@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }

.site-menu__panel .site-nav__list {
  flex-direction: column;
  gap: 0;
}

.site-menu__panel .site-nav__link {
  display: flex;
  padding: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--fs-1);
  border-bottom: 1px solid var(--line);
  min-height: 3.25rem;
}

.site-menu__panel .site-nav__link::after { content: none; }
.site-menu__panel .tab-mark { display: none; }

.site-menu__panel .site-nav__link[aria-current="page"]::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  margin-right: var(--s-3);
  background: var(--accent);
}

.site-menu__panel .site-header__actions {
  flex-direction: column;
  align-items: stretch;
  margin-top: var(--s-5);
}

.site-header__quick { display: none; }

@media (min-width: 48em) and (max-width: 79.99em) {
  .site-header:not(.site-header--compact) .site-header__quick { display: inline-flex; margin-right: var(--s-2); }
}

@media (min-width: 48em) {
  .site-header__inner { min-height: 4.5rem; }
  .site-logo { height: 1.625rem; }
}

/* The open bar starts at 80em: below that the four links, the count, the search and the actions do not fit in
   German or French, so narrower screens use the menu (and keep the main action beside it, .site-header__quick).
   The tagline is not in the header any more (Polish-3 3b): it is in the landing hero and the footer. */
@media (min-width: 80em) {
  .site-header:not(.site-header--compact) .site-header__bar {
    display: flex;
    flex: 1;
    align-items: center;
    gap: var(--s-4);
    min-width: 0; /* the bar may shrink instead of pushing the actions out */
  }

  .site-header:not(.site-header--compact) .site-menu { display: none; }

  .site-header__bar .site-nav { margin-left: var(--s-6); }
  .site-header__bar .site-header__actions { margin-left: auto; }
}

/* ---------- "<n> people joined" (header stat) ----------
   A quiet fact, not a live counter: a small static lime dot with a soft halo (no pulse, no blink), the number in
   the text colour and a little heavier, the words in muted mono. In the bar from 80em; inside the menu below that.
   The number counts up once over a hidden copy of the final text (same grid cell), so the width never changes. */

.site-count {
  display: none;
  align-items: center;
  gap: var(--s-2);
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs--1);
  line-height: 1.2;
  white-space: nowrap;
  cursor: default;
}

/* The halo is a ring of the same lime at low opacity: decorative only, the words carry the meaning. */
.site-count__dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0.1875rem color-mix(in srgb, var(--accent) 35%, transparent);
}

.site-count__text { min-width: 0; }

.site-count__n {
  display: inline-grid;
  margin-right: 0.15em; /* mono words already carry their own space; this keeps the number from crowding them */
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.site-count__n > * { grid-area: 1 / 1; text-align: end; }
.site-count__ghost { visibility: hidden; }

.site-menu__panel .site-count {
  display: flex;
  margin-top: var(--s-5);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
  white-space: normal;
}

@media (min-width: 80em) {
  .site-header__bar .site-count { display: flex; margin-left: auto; }
  .site-header__bar .site-count ~ .site-header__actions { margin-left: var(--s-5); }
  .site-header__bar .site-search + .site-header__actions { margin-left: 0; } /* the bar's gap is enough */
}

/* ---------- Find people (header) ----------
   In the open bar: a search icon (a <details>) that opens a small form under it. In the menu: a plain form at the
   top of the panel. Both submit to Discover → People. */

.site-search { position: relative; }
.site-search > summary { list-style: none; cursor: pointer; }
.site-search > summary::-webkit-details-marker { display: none; }
.site-search[open] > summary { color: var(--text); }

.site-search__panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--s-2));
  z-index: 20;
  display: grid;
  gap: var(--s-2);
  width: min(22rem, calc(100vw - 2 * var(--s-4)));
  padding: var(--s-4);
  background: var(--raised);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
}
.site-search[open] .site-search__panel { animation: menu-in var(--t-base) var(--ease-out); }

.site-search__row {
  display: flex;
  gap: var(--s-2);
}
.site-search__row .input { flex: 1; min-width: 0; }

.site-search--panel {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-5);
}
.site-search--panel .input { flex: 1; min-width: 0; }

/* ---------- Account menu (signed-in header) ---------- */

.user-menu { position: relative; }

.user-menu__button {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  min-width: var(--control-h);
  min-height: var(--control-h);
  padding: 0 var(--s-2);
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.user-menu__button::-webkit-details-marker { display: none; }
/* "New replies" (community notifications): a small ink dot on the avatar; the summary's aria-label says it too. */
.user-menu__button { position: relative; }
.user-menu__dot {
  position: absolute;
  top: 0.45rem;
  left: calc(var(--s-2) + 1.55rem);
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 2px var(--paper);
}
.user-menu__button .icon { width: var(--icon-s); height: var(--icon-s); transition: transform var(--t-base) var(--ease-out); }
.user-menu[open] .user-menu__button .icon { transform: rotate(180deg); }

@media (hover: hover) {
  .user-menu__button:hover { color: var(--text); }
}

.user-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--s-2));
  min-width: 14rem;
  margin: 0;
  padding: var(--s-2) 0;
  list-style: none;
  background: var(--raised);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
}

.user-menu[open] .user-menu__panel { animation: menu-in var(--t-base) var(--ease-out); }

.user-menu__who {
  padding: var(--s-2) var(--s-4) var(--s-3);
  margin-bottom: var(--s-2);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs--2);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.user-menu__item {
  display: flex;
  align-items: center;
  min-height: var(--control-h);
  padding: 0 var(--s-4);
  color: var(--text);
  text-decoration: none;
}

.mod-count {
  margin-inline-start: var(--s-2);
  padding-inline: var(--s-2);
  background: var(--tint);
  border: 1px solid var(--line);
  font-size: var(--fs--2);
}

@media (hover: hover) {
  .user-menu__item:hover { background: var(--tint); }
}

/* Phone menu: same links, listed openly. */
.user-links {
  margin: 0;
  padding: 0;
  list-style: none;
}

.user-links__who {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--control-h);
  overflow-wrap: anywhere;
}

.user-links a {
  display: flex;
  align-items: center;
  min-height: var(--control-h);
  color: var(--text);
  text-decoration: none;
  border-top: 1px solid var(--line);
}

/* ---------- Site footer ----------
   One 12-column grid. Phones: brand across, link columns two by two, the bottom bar stacked with full-width controls.
   48em: brand across, three columns of 4. 64em: brand and the three columns take 3 each; the bar splits 6 / 6.
   Every control (language select, its button, theme switch) shares --footer-control-h, --radius-btn and a
   --line-strong edge; on touch screens they all grow to the large control height together. */

.site-footer {
  --footer-control-h: var(--control-h-lg);
  --footer-gap: var(--s-5);
  margin-top: var(--section);
  padding-bottom: calc(var(--s-6) + env(safe-area-inset-bottom));
  color: var(--muted);
}

@media (pointer: coarse) {
  .site-footer { --footer-control-h: var(--control-h-lg); }
}

.site-footer__inner {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-6) var(--footer-gap);
  padding-top: var(--s-7);
}

/* Hairline over the footer, content width only (like the header). */
.site-footer__inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: max(var(--pad), env(safe-area-inset-left));
  right: max(var(--pad), env(safe-area-inset-right));
  height: 1px;
  background: var(--line);
}

/* After a dark band (landing) the footer starts right under it, without the hairline. */
.site-footer--flush { margin-top: 0; }
.site-footer--flush .site-footer__inner::before { content: none; }

.site-footer__brand {
  grid-column: 1 / -1;
  display: grid;
  gap: var(--s-2);
  align-content: start;
  justify-items: start;
}

.site-footer__home { display: inline-flex; align-items: center; min-height: var(--control-h); color: var(--text); }
.site-footer__brand .site-logo { height: 1.5rem; }
.site-footer__domain { margin: 0; font-size: var(--fs--2); letter-spacing: var(--track-label); }
.site-footer__tagline { margin: 0; max-width: 28ch; color: var(--text); }

.site-footer__social { display: flex; flex-wrap: wrap; gap: 0 var(--s-4); margin: 0; padding: 0; list-style: none; }
.site-footer__social a { display: inline-flex; align-items: center; min-height: var(--control-h); color: var(--muted); }

.site-footer__col { min-width: 0; }
.site-footer__heading { margin: 0 0 var(--s-1); color: var(--text); }

.site-footer__links {
  display: grid;
  justify-items: start;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A hairline grows under the hovered or focused link (transform only). Long words (de, fr) wrap inside the column. */
.site-footer__links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  color: var(--muted);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: none;
}

.site-footer__links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.625rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-base) var(--ease-out);
}

[dir="rtl"] .site-footer__links a::after { transform-origin: right; }

.site-footer__links a:focus-visible { color: var(--text); }
.site-footer__links a:focus-visible::after { transform: scaleX(1); }

@media (hover: hover) {
  .site-footer__links a:hover { color: var(--text); }
  .site-footer__links a:hover::after { transform: scaleX(1); }
}

/* Bottom bar: copyright (sentence case, from LEGAL_OWNER_NAME) and the controls. */
.site-footer__bar {
  grid-column: 1 / -1;
  display: grid;
  gap: var(--s-4) var(--footer-gap);
  align-items: center;
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}

.site-footer__copy { margin: 0; font-size: var(--fs--1); }

.site-footer__controls { display: grid; gap: var(--s-3); }

/* Language: one control. Without JS the select and "Change" are joined (plain POST); with JS the select sends the
   form on change (language.js) and the button is hidden, so the select gets all four corners. */
.lang-form { display: flex; min-width: 0; }

.lang-form__select { flex: 1; min-width: 0; }

.lang-form__select .select {
  min-height: var(--footer-control-h);
  padding-left: 2.5rem;
  border-radius: var(--radius-btn) 0 0 var(--radius-btn);
}

.lang-form__select > .icon:first-child { left: 0.875rem; right: auto; }

.lang-form__submit {
  min-height: var(--footer-control-h);
  margin-left: -1px;
  border-radius: 0 var(--radius-btn) var(--radius-btn) 0;
}

.js .lang-form__submit { display: none; }
.js .lang-form__select .select { border-radius: var(--radius-btn); }

/* Theme switch: a framed track of three equal options. The chosen one is filled with the text colour; where :has()
   works the fill is one block that slides to the chosen option. */
.theme-switch {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: var(--footer-control-h, var(--control-h-lg));
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn);
}

.theme-switch__option {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--footer-control-h, var(--control-h-lg)) - 8px);
  padding: 0 var(--s-3);
  background: transparent;
  border: 0;
  border-radius: calc(var(--radius-btn) - 3px);
  color: var(--muted);
  font-size: var(--fs--1);
  white-space: nowrap;
  cursor: pointer;
  transition: none;
}

.theme-switch__option[aria-pressed="true"] {
  background: var(--text);
  color: var(--paper);
}

@media (hover: hover) {
  .theme-switch__option:not([aria-pressed="true"]):hover { color: var(--text); }
}

@supports selector(:has(*)) {
  .theme-switch::before {
    content: "";
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc((100% - 6px) / 3);
    background: var(--text);
    border-radius: calc(var(--radius-btn) - 3px);
    transition: transform var(--t-base) var(--ease-out);
  }
  .theme-switch:has([data-theme-choice="light"][aria-pressed="true"])::before { transform: translateX(100%); }
  .theme-switch:has([data-theme-choice="dark"][aria-pressed="true"])::before { transform: translateX(200%); }
  .theme-switch__option[aria-pressed="true"] { background: transparent; }
}

@media (min-width: 48em) {
  .site-footer__inner { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .site-footer__col { grid-column: span 4; }
  .site-footer__bar { grid-template-columns: minmax(0, 1fr) auto; }
  .site-footer__controls { display: flex; flex-wrap: wrap; justify-content: flex-end; }
  /* 13rem for the select alone (with JS); without JS the "Change" button is added, not taken out of the select
     (it used to squeeze the language name to "En"). */
  .lang-form { width: auto; }
  .lang-form__select { flex: 0 0 13rem; }
}

@media (min-width: 64em) {
  .site-footer__brand { grid-column: 1 / span 3; }
  .site-footer__col { grid-column: span 3; }
  .site-footer__bar { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .site-footer__copy { grid-column: 1 / span 6; }
  .site-footer__controls { grid-column: 7 / span 6; }
}

/* ---------- Toast ---------- */
/* Without JS messages sit in the page flow under the header; with JS they float at the bottom. */

.toasts {
  display: grid;
  gap: var(--s-2);
}

html:not(.js) .toasts:not(:empty) {
  padding: var(--s-4) max(var(--pad), env(safe-area-inset-right)) 0 max(var(--pad), env(safe-area-inset-left));
}

.js .toasts {
  position: fixed;
  z-index: 50;
  left: 0;
  right: 0;
  bottom: 0;
  justify-items: center;
  padding: 0 max(var(--s-4), env(safe-area-inset-right)) max(var(--s-4), env(safe-area-inset-bottom)) max(var(--s-4), env(safe-area-inset-left));
  pointer-events: none;
}

@media (min-width: 48em) {
  .js .toasts {
    justify-items: start;
    padding-left: max(var(--s-6), env(safe-area-inset-left));
    padding-bottom: max(var(--s-6), env(safe-area-inset-bottom));
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: min(100%, 26rem);
  min-height: 3rem;
  padding: var(--s-1) var(--s-1) var(--s-1) var(--s-4);
  background: var(--raised);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop);
  color: var(--text);
  pointer-events: auto;
}

.toast--error { border-left: 3px solid var(--danger); }

.toast__text {
  flex: 1;
  padding-block: var(--s-2);
}

.toast__icon { color: var(--danger); }
.toast:not(.toast--error) .toast__icon { display: none; }

.js .toast { animation: toast-in var(--t-base) var(--ease-out) both; }

.toast.is-leaving {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms, transform 160ms;
}

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Empty state: an empty record waiting for its marks ---------- */

.empty {
  display: grid;
  justify-items: start;
  gap: var(--s-4);
  padding: var(--s-6) var(--s-5);
  border: 1px dashed var(--line-strong);
}

/* Without the dashed frame: for pages where the empty state sits in a column of content (feed, news). */
.empty--plain { border: 0; padding-inline: 0; }

.empty__marks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* An h2 (it follows the page h1) that looks like the old h3. */
.empty__title {
  font-size: var(--fs-1);
  line-height: var(--lh-snug);
  letter-spacing: -0.02em;
}

@media (min-width: 48em) {
  .empty__title { font-size: var(--fs-2); }
}

.empty__text {
  max-width: 44ch;
  color: var(--muted);
}

/* ---------- Page head: the header block of every inner page ---------- */
/* Eyebrow (mono label, "Shipmark / Explore"), h1, one lede, and optional actions on the right from 48em.
   A hairline closes the block, like the header row of a record. Same block on every page, so pages line up. */

.page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-3) var(--s-6);
  margin-bottom: var(--s-6);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--line);
}

.page-head > * { margin: 0; min-width: 0; }
.page-head h1 { max-width: 20ch; overflow-wrap: anywhere; }
.page-head .lede { max-width: 56ch; }
.page-head__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }

@media (min-width: 48em) {
  .page-head h1 { font-size: var(--fs-5); }
  .page-head:has(> .page-head__actions) { grid-template-columns: minmax(0, 1fr) auto; }
  .page-head > :not(.page-head__actions) { grid-column: 1; }
  .page-head > .page-head__actions { grid-column: 2; grid-row: 1 / span 3; align-self: end; }
}

/* The head of a narrow or card page is a little smaller: the column is narrower. */
.shell--narrow .page-head h1,
.shell--card .page-head h1 { font-size: var(--fs-4); }

/* ---------- Sheet: a form page. Phones: one column. From 64em: head and help left (4), panels right (8) ---------- */
/* Both columns reach the container edges, so the page is balanced and nothing hangs off-centre. */

.sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-6);
}

.sheet__intro { display: grid; gap: var(--s-3); align-content: start; min-width: 0; }
.sheet__intro > h1 { font-size: var(--fs-4); overflow-wrap: anywhere; }
.sheet__intro > :is(h1, p) { margin: 0; }
.sheet__body { display: grid; gap: var(--s-5); min-width: 0; align-content: start; }

@media (min-width: 64em) {
  .sheet { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--s-6); }
  .sheet__intro { grid-column: 1 / span 4; position: sticky; top: var(--s-5); }
  .sheet__body { grid-column: 5 / span 8; }
}

/* Panel: one framed section of a sheet. Danger rule on top = destructive section. */
.panel {
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--line);
}

.panel > h2 { font-size: var(--fs-2); }
.panel--danger { border-top: 3px solid var(--danger); }

@media (min-width: 48em) {
  .panel { padding: var(--s-6); }
}

/* ---------- Tabs: plain links, one page per tab ---------- */

.tabs {
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tabs__list {
  display: flex;
  gap: var(--s-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.tabs__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--control-h);
  padding: 0 var(--s-3);
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: none;
}

/* Only the first tab sits flush with the content edge. (Each link is the first child of its own <li>, so the old
   `.tabs__link:first-child` took the left padding off every tab and pushed each underline to the right.) */
.tabs__list > li:first-child .tabs__link { padding-left: 0; }
.tabs__link:focus-visible { outline-offset: -2px; }

.tabs__link[aria-current="page"] { color: var(--text); }

/* The current tab's underline. An element, not a box-shadow, so a page-to-page view transition can slide it to the
   new tab (motion.css); without one it is simply drawn. Also used by the header nav and the feed tabs. */
.tab-mark {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--text);
  pointer-events: none;
}

@media (forced-colors: active) {
  .tab-mark { background: CanvasText; forced-color-adjust: none; }
}

@media (hover: hover) {
  .tabs__link:hover { color: var(--text); }
}

.tabs__count {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs--2);
  font-variant-numeric: tabular-nums;
}

/* ---------- Like and follow buttons (social/_like.html, _follow.html) ---------- */

.social-form { margin: 0; }
.social-btn { gap: var(--s-2); }
.social-btn[aria-pressed="true"] { background: var(--tint); border-color: var(--text); }
.social-btn[aria-busy="true"] { cursor: progress; }
.social-btn__count { font-family: var(--font-mono); font-size: var(--fs--1); font-variant-numeric: tabular-nums; color: var(--muted); }
.social-note { margin: 0; }


/* ---------- Uptime bars (project page, landing example) ---------- */
/* One bar per day for 30 days; its height is that day's uptime (90-100% fills the track, see bar_height() in
   verification/uptime.py). The height arrives as a class (uptime-bar--h3 ... h20, steps of 5%): the CSP has no
   inline styles. State is never colour alone: up = solid, partial = striped, down = solid ink at the minimum
   height (in this palette danger and signal are the same colour in the dark theme, so ink keeps it apart), no checks = hollow at the minimum height. */
.uptime-bars { --bar-track: 3.5rem; margin-top: var(--s-4); }
.uptime-bars--compact { --bar-track: 2.25rem; }

.uptime-bars__days {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 2px;
  height: var(--bar-track);
  margin: 0;
  padding: 0;
  list-style: none;
}

.uptime-bar {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-width: 0;
  height: 100%;
}

.uptime-bar__fill {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: var(--h, 100%);
  border: 1px solid var(--line-strong);
  transform-origin: bottom;
}

.uptime-bar.is-up .uptime-bar__fill { background: var(--signal); border-color: var(--accent-text); }
.uptime-bar.is-partial .uptime-bar__fill {
  background: repeating-linear-gradient(135deg, var(--signal) 0 2px, transparent 2px 4px);
  border-color: var(--accent-text);
}
.uptime-bar.is-down .uptime-bar__fill { background: var(--text); border-color: var(--text); }
.uptime-bar.is-none .uptime-bar__fill { background: transparent; border-color: var(--line-strong); }

.uptime-bar--h3 { --h: 15%; }
.uptime-bar--h4 { --h: 20%; }
.uptime-bar--h5 { --h: 25%; }
.uptime-bar--h6 { --h: 30%; }
.uptime-bar--h7 { --h: 35%; }
.uptime-bar--h8 { --h: 40%; }
.uptime-bar--h9 { --h: 45%; }
.uptime-bar--h10 { --h: 50%; }
.uptime-bar--h11 { --h: 55%; }
.uptime-bar--h12 { --h: 60%; }
.uptime-bar--h13 { --h: 65%; }
.uptime-bar--h14 { --h: 70%; }
.uptime-bar--h15 { --h: 75%; }
.uptime-bar--h16 { --h: 80%; }
.uptime-bar--h17 { --h: 85%; }
.uptime-bar--h18 { --h: 90%; }
.uptime-bar--h19 { --h: 95%; }
.uptime-bar--h20 { --h: 100%; }

/* Tooltip: date and percent. Opens on hover and on keyboard focus; the text alternative is in the item itself. */
.uptime-bar__tip {
  position: absolute;
  bottom: calc(100% + var(--s-2));
  left: 50%;
  z-index: 5;
  padding: var(--s-1) var(--s-2);
  background: var(--raised);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--fs--2);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity var(--t-fast) var(--ease-out);
}

.uptime-bar:nth-child(-n+4) .uptime-bar__tip { left: 0; transform: none; }
.uptime-bar:nth-last-child(-n+4) .uptime-bar__tip { right: 0; left: auto; transform: none; }

.uptime-bar:hover .uptime-bar__tip,
.uptime-bar:focus-visible .uptime-bar__tip { opacity: 1; }

.uptime-bars__axis {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-2);
}

.uptime-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  margin: var(--s-4) 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: var(--fs--1);
}

.uptime-legend li { display: inline-flex; align-items: center; gap: var(--s-2); }
.uptime-bar--swatch { display: block; width: 0.625rem; height: 0.875rem; }
.uptime-bar--swatch.is-up { background: var(--signal); border: 1px solid var(--accent-text); }
.uptime-bar--swatch.is-partial {
  background: repeating-linear-gradient(135deg, var(--signal) 0 2px, transparent 2px 4px);
  border: 1px solid var(--accent-text);
}
.uptime-bar--swatch.is-down { background: var(--text); border: 1px solid var(--text); }
.uptime-bar--swatch.is-none { border: 1px solid var(--line-strong); }
