/* Studio design system 2026.11.08. Built from websites/design-system/src by build.py; edit the sources. */
/* Studio design system: tokens.

   Forked on 2026-11-08 from the CommunityScale design system (app/design/tokens/tokens.css and the rules in
   app/design/web/): the same spacing, 12-column grid with 32px gutters, card, button, and header conventions.
   The owner's changes: system fonts only, grayscale by default, the grays of nelsoki (studio/websites/nelsoki,
   a Flexoki variant with a neutral ground; Flexoki is Copyright (c) 2023 Steph Ango, MIT License, notice in
   nelsoki/README.md) with a gray page rather than white, and square corners. A site that wants a color sets
   --ds-accent (and, if it needs them, the status colors) in its own stylesheet; nothing else takes a hue.

   Light values sit on bare :root. Dark values are set twice, under [data-theme="dark"] (what ds.js sets) and
   under prefers-color-scheme for a page without the script, guarded so an explicit light choice wins. */

:root {
  color-scheme: light;

  /* Type. System faces only: no @font-face anywhere in the system. */
  --ds-font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --ds-font-serif: ui-serif, "New York", "Iowan Old Style", Georgia, Cambria, "Times New Roman", serif;
  --ds-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --ds-font-title: var(--ds-font-sans);   /* page titles (h1); a site may set var(--ds-font-serif), as Now City does */

  /* Sizes on a 16px root. Body copy is 17px and nothing is set under 14px. */
  --ds-text-sm: 0.875rem;    /* 14px: captions, table notes, footer fine print */
  --ds-text-ui: 0.9375rem;   /* 15px: nav, buttons, labels, inputs */
  --ds-text-base: 1.0625rem; /* 17px: body */
  --ds-text-lg: 1.25rem;     /* 20px: h4, lead paragraphs */
  --ds-text-xl: 1.5rem;      /* 24px: h3 */
  --ds-text-2xl: 1.875rem;   /* 30px: h2 */
  --ds-text-3xl: 2.375rem;   /* 38px: h1 */
  --ds-leading: 1.6;
  --ds-leading-ui: 1.4;
  --ds-leading-tight: 1.2;
  --ds-weight-regular: 400;
  --ds-weight-strong: 600;

  /* The neutral ramp: nelsoki's base scale, Flexoki's lightness steps with the warmth taken out, so every step
     has equal red, green, and blue. test_ds.py checks these against nelsoki/nelsoki.json. */
  --ds-white: #fcfcfc;
  --ds-gray-50: #f0f0f0;
  --ds-gray-100: #e4e4e4;
  --ds-gray-150: #d8d8d8;
  --ds-gray-200: #cccccc;
  --ds-gray-300: #b5b5b5;
  --ds-gray-400: #9d9d9d;
  --ds-gray-500: #858585;
  --ds-gray-600: #6e6e6e;
  --ds-gray-700: #565656;
  --ds-gray-800: #3e3e3e;
  --ds-gray-850: #333333;
  --ds-gray-900: #272727;
  --ds-gray-950: #1b1b1b;
  --ds-black: #0f0f0f;

  /* Space on a 4px step. --ds-gap is the grid gutter and the space between cards, 32px both ways. */
  --ds-space-1: 0.25rem;
  --ds-space-2: 0.5rem;
  --ds-space-3: 0.75rem;
  --ds-space-4: 1rem;
  --ds-space-5: 1.25rem;
  --ds-space-6: 1.5rem;
  --ds-space-8: 2rem;
  --ds-space-12: 3rem;
  --ds-space-16: 4rem;
  --ds-gap: 2rem;
  --ds-gutter: 1rem;         /* page side padding: 16px on phones, 24px from 640px, 32px from 1024px */
  --ds-max: 80rem;           /* the widest layout, 1280px */
  --ds-measure: 68ch;        /* the widest line of running text */
  --ds-header-h: 3.3125rem;  /* 53px, the CommunityScale docs and maps header */

  /* Square corners everywhere. The tokens stay so a site, or a later change here, can round them again. */
  --ds-radius-sm: 0;
  --ds-radius-md: 0;
  --ds-radius-lg: 0;
  --ds-radius-full: 0;
  --ds-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --ds-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

  /* Roles, light. Components use these, never the ramp directly. The page is a light gray, and cards, menus,
     and dialogs sit on it in nelsoki's white. */
  --ds-page: var(--ds-gray-50);
  --ds-surface: var(--ds-white);        /* cards, menus, dialogs */
  --ds-subtle: var(--ds-white);         /* a quiet band or a callout */
  --ds-sunken: var(--ds-gray-100);      /* code, wells, the segmented control's track */
  --ds-heading: var(--ds-black);
  --ds-text: var(--ds-gray-950);
  --ds-muted: var(--ds-gray-950);       /* captions and help text: the text color, since there is no gray text; set them apart by size */
  --ds-rule: var(--ds-gray-150);        /* hairlines, card rings */
  --ds-rule-strong: var(--ds-gray-200); /* table heads, outlined badges */
  --ds-control-line: var(--ds-gray-500); /* input and search outlines: 3:1 or more against the page */
  --ds-fill: var(--ds-gray-150);        /* primary buttons, markers, the current page */
  --ds-fill-hover: var(--ds-gray-200);
  --ds-hover: var(--ds-gray-100);       /* a hovered row, menu item, or tertiary button */
  --ds-link: var(--ds-black);
  --ds-link-line: var(--ds-gray-400);   /* a link's underline at rest; it takes the text color on hover */
  --ds-inverse: var(--ds-black);        /* the one dark element a page may have, such as a selected chip */
  --ds-on-inverse: var(--ds-white);

  /* The one hook for color. Grayscale by default; a site may set it to a hue. */
  --ds-accent: var(--ds-black);
  --ds-focus: var(--ds-accent);

  /* Status, grayscale by default too: a status reads from its icon and words. A site may give these hues. */
  --ds-danger: var(--ds-black);
  --ds-success: var(--ds-black);
  --ds-warning: var(--ds-black);
}

@media (min-width: 640px) {
  :root { --ds-gutter: 1.5rem; }
}
@media (min-width: 1024px) {
  :root { --ds-gutter: 2rem; }
}

/* Dark: nelsoki's own roles. The page is its black, surfaces its 950, rules its 900 and 800, text its 200 (11.9:1
   on the page), and muted text its 400 (7.1:1). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ds-page: var(--ds-black);
    --ds-surface: var(--ds-gray-950);
    --ds-subtle: var(--ds-gray-950);
    --ds-sunken: var(--ds-gray-900);
    --ds-heading: var(--ds-gray-50);
    --ds-text: var(--ds-gray-200);
    --ds-muted: var(--ds-gray-200);
    --ds-rule: var(--ds-gray-900);
    --ds-rule-strong: var(--ds-gray-800);
    --ds-control-line: var(--ds-gray-600);
    --ds-fill: var(--ds-gray-850);
    --ds-fill-hover: var(--ds-gray-800);
    --ds-hover: var(--ds-gray-900);
    --ds-link: var(--ds-gray-50);
    --ds-link-line: var(--ds-gray-600);
    --ds-inverse: var(--ds-gray-50);
    --ds-on-inverse: var(--ds-black);
    --ds-accent: var(--ds-gray-50);
    --ds-danger: var(--ds-gray-50);
    --ds-success: var(--ds-gray-50);
    --ds-warning: var(--ds-gray-50);
    --ds-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --ds-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ds-page: var(--ds-black);
  --ds-surface: var(--ds-gray-950);
  --ds-subtle: var(--ds-gray-950);
  --ds-sunken: var(--ds-gray-900);
  --ds-heading: var(--ds-gray-50);
  --ds-text: var(--ds-gray-200);
  --ds-muted: var(--ds-gray-200);
  --ds-rule: var(--ds-gray-900);
  --ds-rule-strong: var(--ds-gray-800);
  --ds-control-line: var(--ds-gray-600);
  --ds-fill: var(--ds-gray-850);
  --ds-fill-hover: var(--ds-gray-800);
  --ds-hover: var(--ds-gray-900);
  --ds-link: var(--ds-gray-50);
  --ds-link-line: var(--ds-gray-600);
  --ds-inverse: var(--ds-gray-50);
  --ds-on-inverse: var(--ds-black);
  --ds-accent: var(--ds-gray-50);
  --ds-danger: var(--ds-gray-50);
  --ds-success: var(--ds-gray-50);
  --ds-warning: var(--ds-gray-50);
  --ds-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --ds-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
}

/* Studio design system: base. Plain elements styled from the tokens, so a page of ordinary HTML already looks
   right before any class is added. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--ds-header-h) + var(--ds-space-4));
}

body {
  margin: 0;
  background: var(--ds-page);
  color: var(--ds-text);
  font-family: var(--ds-font-sans);
  font-size: var(--ds-text-base);
  line-height: var(--ds-leading);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.5em;
  color: var(--ds-heading);
  font-weight: var(--ds-weight-strong);
  line-height: var(--ds-leading-tight);
  text-wrap: balance;
}
h1 { font-family: var(--ds-font-title); font-size: var(--ds-text-3xl); letter-spacing: -0.02em; }
h2 { font-size: var(--ds-text-2xl); letter-spacing: -0.015em; }
h3 { font-size: var(--ds-text-xl); letter-spacing: -0.01em; }
h4 { font-size: var(--ds-text-lg); }
h5, h6 { font-size: var(--ds-text-base); }

p, ul, ol, dl, blockquote, pre, table, figure { margin: 0 0 1em; }
ul, ol { padding-left: 1.25em; }
li + li { margin-top: 0.25em; }
p { text-wrap: pretty; }

a {
  color: var(--ds-link);
  text-decoration-line: underline;
  text-decoration-color: var(--ds-link-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}
a:hover { text-decoration-color: currentColor; }

strong, b { font-weight: var(--ds-weight-strong); color: var(--ds-heading); }
small { font-size: var(--ds-text-sm); }

code, kbd, samp, pre { font-family: var(--ds-font-mono); font-size: 0.9em; }
pre code, pre kbd, pre samp { font-size: 1em; }   /* the pre is already 0.9em; do not shrink twice */
:not(pre) > code, kbd {
  padding: 0.1em 0.35em;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-sunken);
  color: var(--ds-heading);
}
pre {
  overflow-x: auto;
  padding: var(--ds-space-4);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-sunken);
  color: var(--ds-heading);
  line-height: 1.5;
}

hr { margin: var(--ds-space-8) 0; border: 0; border-top: 1px solid var(--ds-rule); }

blockquote {
  margin-left: 0;
  padding-left: var(--ds-space-4);
  border-left: 3px solid var(--ds-rule-strong);
  color: var(--ds-text);
}

img, svg, video, canvas { max-width: 100%; }
img, video { height: auto; }

table { border-collapse: collapse; font-variant-numeric: tabular-nums; }

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }

:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
::selection { background: var(--ds-fill); color: var(--ds-heading); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Studio design system: layout. The page frame (container, grid, header, drawer, footer) after the CommunityScale
   design system: one 12-column grid with 32px gutters inside an 80rem column, a solid sticky header 53px tall
   that never crowds, and a footer of link columns, then socials, then the fine print. */

.ds-container {
  width: 100%;
  max-width: calc(var(--ds-max) + 2 * var(--ds-gutter));
  margin-inline: auto;
  padding-left: max(var(--ds-gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--ds-gutter), env(safe-area-inset-right, 0px));
}
.ds-main { padding-block: var(--ds-space-12); }

/* Grids. Halves, thirds, and quarters stack to one column on phones; the 12-column grid with spans only
   applies from 1024px. Cards in a grid sit --ds-gap (32px) apart both ways. */
.ds-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--ds-gap); }
@media (min-width: 640px) {
  .ds-grid--2, .ds-grid--3, .ds-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .ds-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ds-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ds-grid--12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .ds-span-3 { grid-column: span 3; }
  .ds-span-4 { grid-column: span 4; }
  .ds-span-5 { grid-column: span 5; }
  .ds-span-6 { grid-column: span 6; }
  .ds-span-7 { grid-column: span 7; }
  .ds-span-8 { grid-column: span 8; }
  .ds-span-9 { grid-column: span 9; }
  .ds-span-12 { grid-column: span 12; }
}
.ds-grid > * { min-width: 0; }
.ds-stack { display: flex; flex-direction: column; gap: var(--ds-gap); }
.ds-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-3); }

/* Running text. Headings inside get room above them; nothing else changes. */
.ds-prose { max-width: var(--ds-measure); }
.ds-prose > * + h2 { margin-top: 2em; }
.ds-prose > * + h3 { margin-top: 1.6em; }
.ds-prose img, .ds-prose video { border-radius: var(--ds-radius-lg); }
.ds-lead { font-size: var(--ds-text-lg); line-height: 1.5; color: var(--ds-text); }
.ds-section { padding-block: var(--ds-space-12); border-top: 1px solid var(--ds-rule); }

/* Header. Solid (no frosted glass), a hairline under it, and the account or theme toggle always last at the
   top right. Below 1024px the links fold into the drawer behind a menu button left of the name, so nothing in
   the header ever wraps to a second row. */
.ds-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--ds-page);
  border-bottom: 1px solid var(--ds-rule);
}
.ds-header__inner { display: flex; align-items: center; gap: var(--ds-space-3); height: var(--ds-header-h); }
.ds-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  color: var(--ds-heading);
  font-size: var(--ds-text-ui);
  font-weight: var(--ds-weight-strong);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.ds-brand > svg, .ds-brand > img { flex: none; width: 20px; height: 20px; }   /* the site's own icon, always before its name */
.ds-brand__product { font-weight: var(--ds-weight-regular); }
.ds-brand--serif { font-family: var(--ds-font-serif); font-size: var(--ds-text-lg); letter-spacing: 0; }   /* a site name set in the system serif */
.ds-nav { display: none; }
.ds-header__menu { display: inline-flex; margin-left: calc(-1 * var(--ds-space-2)); }
.ds-header__end { display: flex; align-items: center; gap: var(--ds-space-1); margin-left: auto; }
@media (min-width: 1024px) {
  .ds-nav { display: flex; align-items: center; gap: var(--ds-space-1); margin-left: var(--ds-space-4); }
  .ds-header .ds-header__menu { display: none; } /* beats .ds-icon-btn, which comes later */
}
/* A site with more destinations than fit in the header keeps the menu button at every width, with the full list
   in the drawer; its inline links, if any, are the few most used. */
@media (min-width: 1024px) {
  .ds-header.ds-header--drawer .ds-header__menu { display: inline-flex; }
}
.ds-nav a, .ds-drawer__nav a {
  border-radius: var(--ds-radius-md);
  color: var(--ds-text);
  font-size: var(--ds-text-ui);
  line-height: var(--ds-leading-ui);
  text-decoration: none;
}
.ds-nav a { padding: 0.375rem 0.625rem; }
.ds-nav a:hover, .ds-drawer__nav a:hover { background: var(--ds-hover); color: var(--ds-heading); }
.ds-nav a[aria-current="page"], .ds-drawer__nav a[aria-current="page"] { background: var(--ds-fill); color: var(--ds-heading); }

/* The drawer: a native <dialog> that opens from the left. ds.js opens it from [data-ds-open]. */
.ds-drawer {
  inset: 0 auto 0 0;
  width: min(20rem, 85vw);
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--ds-rule);
  background: var(--ds-surface);
  color: var(--ds-text);
}
.ds-drawer::backdrop { background: rgba(0, 0, 0, 0.4); }
.ds-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--ds-header-h);
  padding-inline: var(--ds-gutter);
  border-bottom: 1px solid var(--ds-rule);
}
.ds-drawer__nav { display: flex; flex-direction: column; gap: 2px; padding: var(--ds-space-3); }
.ds-drawer__nav a { padding: 0.625rem 0.75rem; font-size: var(--ds-text-base); }
/* A long menu in groups: a plain label in the heading color over each list (never all caps, never gray). */
.ds-drawer { overflow-y: auto; }
.ds-drawer__group { margin: var(--ds-space-4) 0 var(--ds-space-1); padding: 0 0.75rem; color: var(--ds-heading); font-size: var(--ds-text-sm); font-weight: var(--ds-weight-strong); }
.ds-drawer__group:first-child { margin-top: 0; }
.ds-drawer__list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.ds-drawer__list li + li { margin-top: 0; }
.ds-drawer__list a { display: block; }

/* Footer: link columns, then a row of socials in one gray (never brand colors), then the fine print. */
.ds-footer {
  margin-top: var(--ds-space-16);
  padding-block: var(--ds-space-12) var(--ds-space-8);
  border-top: 1px solid var(--ds-rule);
  font-size: var(--ds-text-ui);
}
.ds-footer__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ds-gap); }
@media (min-width: 768px) { .ds-footer__cols { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ds-footer__title { margin: 0 0 var(--ds-space-3); color: var(--ds-heading); font-size: var(--ds-text-ui); font-weight: var(--ds-weight-strong); }
.ds-footer ul { display: flex; flex-direction: column; gap: var(--ds-space-2); margin: 0; padding: 0; list-style: none; }
.ds-footer li + li { margin-top: 0; }
.ds-footer a { color: var(--ds-text); text-decoration: none; }
.ds-footer a:hover { color: var(--ds-heading); text-decoration: underline; }
.ds-footer__social { display: flex; gap: var(--ds-space-1); margin-top: var(--ds-space-8); }
/* The name in the fine print, with the site's mark before it when it has one. */
.ds-footer__brand { display: inline-flex; align-items: center; gap: 0.5em; }   /* icon, name, and product, as in the header */
.ds-footer__brand > svg, .ds-footer__brand > img { flex: none; width: 20px; height: 20px; }
.ds-footer__base {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-2) var(--ds-space-6);
  margin-top: var(--ds-space-6);
  padding-top: var(--ds-space-6);
  border-top: 1px solid var(--ds-rule);
  font-size: var(--ds-text-sm);
}
.ds-footer__base:first-child { margin-top: 0; padding-top: 0; border-top: 0; }   /* a footer of fine print alone: the footer's own rule is enough */

/* Utilities. */
.ds-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.ds-skip { position: absolute; left: var(--ds-space-4); top: -100px; z-index: 50; }
.ds-skip:focus { top: var(--ds-space-2); }
.ds-muted { color: var(--ds-muted); }
.ds-num { font-variant-numeric: tabular-nums; }
.ds-serif { font-family: var(--ds-font-serif); }

/* Studio design system: components. Class names are ds-<thing>, with --<variant> modifiers. Every color comes
   from a role token in tokens.css; nothing here names a hue. */

/* Icon button: a 36px square for a single icon (menu, theme toggle, close, socials). */
.ds-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: var(--ds-radius-md);
  background: transparent;
  color: var(--ds-text);
}
.ds-icon-btn:hover { background: var(--ds-hover); color: var(--ds-heading); }
/* An icon is a block, never an inline drawing on a text baseline, so it sits at its button's exact center however
   the markup wraps it. An inline svg inside a wrapping span rested on the span's baseline and rode 4px high (the
   theme toggle, 2026-11-09); test_ds.py measures every icon control so it cannot come back. */
.ds-icon-btn svg { display: block; width: 20px; height: 20px; flex: none; }

/* The theme toggle shows the mode in view: a sun in light, a moon in dark. Each wrapper is a centering flex box of
   its own, the same in every state that shows it. */
.ds-theme-toggle .ds-when-light, .ds-theme-toggle .ds-when-dark { align-items: center; justify-content: center; }
.ds-theme-toggle .ds-when-light { display: flex; }
.ds-theme-toggle .ds-when-dark { display: none; }
:root[data-theme="dark"] .ds-theme-toggle .ds-when-light { display: none; }
:root[data-theme="dark"] .ds-theme-toggle .ds-when-dark { display: flex; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .ds-theme-toggle .ds-when-light { display: none; }
  :root:not([data-theme]) .ds-theme-toggle .ds-when-dark { display: flex; }
}

/* Buttons: one text size. A primary action is a gray fill with black text; a secondary one a black outline
   with no fill; a tertiary one is only text until hovered. No big black blocks. */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.5rem 0.875rem;
  border: 0;
  border-radius: var(--ds-radius-md);
  background: var(--ds-fill);
  color: var(--ds-heading);
  font-size: var(--ds-text-ui);
  font-weight: var(--ds-weight-strong);
  line-height: var(--ds-leading-ui);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s;
}
.ds-btn:hover { background: var(--ds-fill-hover); }
.ds-btn svg { display: block; width: 18px; height: 18px; flex: none; }
.ds-btn--secondary { background: transparent; box-shadow: inset 0 0 0 1px var(--ds-heading); }
.ds-btn--secondary:hover { background: var(--ds-hover); }
.ds-btn--tertiary { background: transparent; }
.ds-btn--tertiary:hover { background: var(--ds-hover); }
.ds-btn:disabled, .ds-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* Links outside running text. */
.ds-link-quiet { color: var(--ds-link); text-decoration: none; }
.ds-link-quiet:hover { text-decoration: underline; text-decoration-color: currentColor; }
.ds-link-arrow { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: var(--ds-weight-strong); text-decoration: none; }
.ds-link-arrow:hover { text-decoration: underline; }
.ds-link-arrow svg { width: 18px; height: 18px; transition: transform 0.15s; }
.ds-link-arrow:hover svg { transform: translateX(2px); }

/* Segmented control: choices that switch a view, above the thing they switch. Radio inputs, no script. */
.ds-segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: var(--ds-radius-lg);
  background: var(--ds-sunken);
}
.ds-segmented label { position: relative; }
.ds-segmented input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.ds-segmented span {
  display: block;
  padding: 0.375rem 0.75rem;
  border-radius: var(--ds-radius-md);
  color: var(--ds-text);
  font-size: var(--ds-text-ui);
  font-weight: 500;
  line-height: var(--ds-leading-ui);
}
.ds-segmented input:checked + span {
  background: var(--ds-surface);
  color: var(--ds-heading);
  box-shadow: 0 0 0 1px var(--ds-rule), var(--ds-shadow-xs);
}
.ds-segmented input:focus-visible + span { outline: 2px solid var(--ds-focus); outline-offset: 1px; }

/* Card: one object set off from the page. Cards sit on the page color, 32px apart. */
.ds-card {
  display: block;
  padding: var(--ds-space-5);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-surface);
  box-shadow: 0 0 0 1px var(--ds-rule), var(--ds-shadow-xs);
  color: var(--ds-text);
}
.ds-card > :last-child { margin-bottom: 0; }
.ds-card__title { margin: 0 0 0.375em; font-size: var(--ds-text-lg); }
a.ds-card { text-decoration: none; transition: box-shadow 0.15s; }
a.ds-card:hover { box-shadow: 0 0 0 1px var(--ds-rule-strong), var(--ds-shadow-xs); }

/* Marker: a number or icon tile (step numbers, counts, the current item), in the primary button's gray. */
.ds-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: var(--ds-radius-md);
  background: var(--ds-fill);
  color: var(--ds-heading);
  font-size: var(--ds-text-ui);
  font-weight: var(--ds-weight-strong);
  font-variant-numeric: tabular-nums;
}
.ds-marker svg { display: block; width: 18px; height: 18px; }

/* Badge: a short tag on an item. */
.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--ds-radius-full);
  background: var(--ds-sunken);
  color: var(--ds-heading);
  font-size: var(--ds-text-sm);
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.ds-badge--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--ds-rule-strong); }
.ds-badge--inverse { background: var(--ds-inverse); color: var(--ds-on-inverse); }

/* Callout: a note set apart from running text, with an icon on its first line. No colored side rail. */
.ds-callout {
  display: flex;
  gap: var(--ds-space-3);
  margin: 0 0 1em;
  padding: var(--ds-space-4);
  border-radius: var(--ds-radius-lg);
  background: var(--ds-subtle);
  box-shadow: inset 0 0 0 1px var(--ds-rule);
}
.ds-callout > svg { flex: none; width: 20px; height: 20px; margin-top: calc((1lh - 20px) / 2); color: var(--ds-heading); }
.ds-callout > div > :last-child { margin-bottom: 0; }
.ds-callout--danger > svg { color: var(--ds-danger); }
.ds-callout--success > svg { color: var(--ds-success); }
.ds-callout--warning > svg { color: var(--ds-warning); }

/* Table: hairline rows, a stronger rule under the head, numbers right-aligned in tabular figures. */
.ds-table-wrap { overflow-x: auto; margin: 0 0 1em; }
.ds-table-wrap > .ds-table { margin: 0; }
.ds-table { width: 100%; font-size: var(--ds-text-ui); line-height: var(--ds-leading-ui); }
.ds-table th, .ds-table td { padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--ds-rule); text-align: left; vertical-align: top; }
.ds-table th:first-child, .ds-table td:first-child { padding-left: 0; }
.ds-table th:last-child, .ds-table td:last-child { padding-right: 0; }
.ds-table thead th { border-bottom-color: var(--ds-rule-strong); color: var(--ds-heading); font-weight: var(--ds-weight-strong); white-space: nowrap; }
/* A table that stacks on phones: below 640px each row becomes a block, its first cell the row's title and every
   other cell under the label in its data-label, so a wide table never squeezes a column to a sliver. */
@media (max-width: 639px) {
  .ds-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .ds-table--stack, .ds-table--stack tbody, .ds-table--stack tr, .ds-table--stack td { display: block; width: 100%; }
  .ds-table--stack tr { padding-block: var(--ds-space-3); border-bottom: 1px solid var(--ds-rule); }
  .ds-table--stack td, .ds-table--stack td.num { padding: var(--ds-space-1) 0; border: 0; text-align: left; }
  .ds-table--stack td:first-child { color: var(--ds-heading); font-weight: var(--ds-weight-strong); }
  .ds-table--stack td:not(:first-child)[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; color: var(--ds-heading); font-size: var(--ds-text-sm); }
}
.ds-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ds-table caption { caption-side: bottom; padding-top: var(--ds-space-3); color: var(--ds-muted); font-size: var(--ds-text-sm); text-align: left; }

/* Forms. Labels are black; help text may be muted. */
.ds-field { display: flex; flex-direction: column; gap: 0.375rem; }
.ds-label { color: var(--ds-heading); font-size: var(--ds-text-ui); font-weight: 500; }
.ds-help { color: var(--ds-muted); font-size: var(--ds-text-sm); }
.ds-input, .ds-select, .ds-textarea {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface);
  box-shadow: inset 0 0 0 1px var(--ds-control-line);
  color: var(--ds-heading);
  font-size: var(--ds-text-ui);
  line-height: var(--ds-leading-ui);
}
.ds-textarea { min-height: 6rem; resize: vertical; }
.ds-input::placeholder, .ds-textarea::placeholder { color: var(--ds-muted); }
.ds-input:focus-visible, .ds-select:focus-visible, .ds-textarea:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: -1px; }
.ds-field--invalid .ds-input, .ds-field--invalid .ds-textarea { box-shadow: inset 0 0 0 2px var(--ds-danger); }
.ds-check { display: inline-flex; align-items: center; gap: 0.5rem; font-size: var(--ds-text-ui); }
.ds-check input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--ds-heading); }

/* Search box: the CommunityScale place picker's look, an outlined field with the icon inside. */
.ds-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0 0.625rem;
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface);
  box-shadow: inset 0 0 0 1px var(--ds-control-line);
  color: var(--ds-muted);
}
.ds-search svg { display: block; width: 20px; height: 20px; flex: none; }
.ds-search input { flex: 1; min-width: 0; padding: 0.5rem 0; border: 0; outline: none; background: transparent; color: var(--ds-heading); font-size: var(--ds-text-ui); }
.ds-search input::placeholder { color: var(--ds-muted); }
.ds-search:focus-within { outline: 2px solid var(--ds-focus); outline-offset: -1px; }

/* Breadcrumbs, with the thin tall chevron between steps. */
.ds-breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; margin: 0; padding: 0; list-style: none; font-size: var(--ds-text-ui); }
.ds-breadcrumbs li { display: inline-flex; align-items: center; gap: 0.375rem; margin: 0; }
.ds-breadcrumbs a { color: var(--ds-text); text-decoration: none; }
.ds-breadcrumbs a:hover { color: var(--ds-heading); text-decoration: underline; }
.ds-breadcrumbs [aria-current="page"] { color: var(--ds-heading); font-weight: 500; }
.ds-crumb-sep { width: 6px; height: 16px; color: var(--ds-muted); }

/* Stat: one figure with its label above and an optional note. */
.ds-stat { display: flex; flex-direction: column; gap: 0.25rem; }
.ds-stat__label { color: var(--ds-text); font-size: var(--ds-text-ui); }
.ds-stat__value { color: var(--ds-heading); font-size: var(--ds-text-2xl); font-weight: var(--ds-weight-strong); line-height: var(--ds-leading-tight); font-variant-numeric: tabular-nums; }
.ds-stat__note { color: var(--ds-muted); font-size: var(--ds-text-sm); }

/* Dialog: a native <dialog>, opened by ds.js from [data-ds-open]. */
.ds-dialog {
  width: min(32rem, calc(100vw - 2rem));
  padding: var(--ds-space-6);
  border: 0;
  border-radius: var(--ds-radius-lg);
  background: var(--ds-surface);
  box-shadow: 0 0 0 1px var(--ds-rule), var(--ds-shadow-lg);
  color: var(--ds-text);
}
.ds-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.ds-dialog__title { margin: 0 0 0.5rem; font-size: var(--ds-text-lg); }
.ds-dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--ds-space-2); margin-top: var(--ds-space-6); }

/* App tiles: the homescreen grid of wetland.io/admin. Each tile is a link with a square glyph from
   icons/app-*.svg (24px stroke drawings, drawn at 26px) and its name under it. A tile takes its group's color
   from --ds-app-tint, set in the markup (the admin's six groups each have one), so the stylesheet stays gray:
   the drawing is the tint, the glyph's ground is the tint at 14%, and its edge the tint at 28%. Without a tint
   the same recipe gives a plain gray tile. A note under the name says what a plain tile cannot, such as
   "Tailscale only" or a count of jobs that need attention, in words rather than color. */
.ds-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: var(--ds-space-6) var(--ds-space-3); margin: 0; padding: 0; list-style: none; }
.ds-apps > li + li { margin-top: 0; }
.ds-app { display: flex; flex-direction: column; align-items: center; gap: var(--ds-space-2); color: var(--ds-text); text-align: center; text-decoration: none; }
.ds-app__glyph {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 3.75rem;
  height: 3.75rem;
  border-radius: var(--ds-radius-lg);
  color: var(--ds-app-tint, var(--ds-heading));
}
.ds-app__glyph::before, .ds-app__glyph::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.ds-app__glyph::before { z-index: -1; background: currentColor; opacity: 0.14; transition: opacity 0.15s; }
.ds-app__glyph::after { box-shadow: inset 0 0 0 1px currentColor; opacity: 0.28; }
.ds-app:hover .ds-app__glyph::before { opacity: 0.22; }
.ds-app__glyph svg { display: block; width: 26px; height: 26px; }
.ds-app__name { font-size: var(--ds-text-ui); line-height: var(--ds-leading-ui); }
.ds-app__note { display: block; font-size: var(--ds-text-sm); color: var(--ds-muted); }

/* Bottom sheet (ds.js, [data-ds-sheet]): on phones a map page's panel becomes a sheet over the full-screen map,
   with a grab bar that stays in view while the content scrolls. The script sets its height and position. */
@media (max-width: 720px) {
  .ds-sheet-on .ds-sheet {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; width: 100%; max-height: none;
    border-right: 0; border-top: 1px solid var(--ds-rule-strong);
    box-shadow: 0 -4px 18px rgba(15, 15, 15, 0.14); overscroll-behavior: contain;
  }
  .ds-sheet__handle {
    position: sticky; top: 0; z-index: 3; display: block; width: 100%; height: 28px; margin: 0; padding: 0;
    border: 0; background: inherit; cursor: grab; touch-action: none;
  }
  .ds-sheet__handle::after {
    content: ""; position: absolute; top: 11px; left: 50%; width: 40px; height: 5px; margin-left: -20px;
    background: var(--ds-control-line);
  }
  .ds-sheet__handle:active { cursor: grabbing; }
  .ds-sheet__handle:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: -2px; }
  /* At the peek, the map's bottom controls (scale, attribution) sit just above the sheet. */
  .ds-sheet-on.ds-sheet-peek .maplibregl-ctrl-bottom-left,
  .ds-sheet-on.ds-sheet-peek .maplibregl-ctrl-bottom-right { bottom: calc(var(--ds-sheet-peek, 140px) + 4px) !important; }
}
@media (min-width: 721px) { .ds-sheet__handle { display: none; } }

/* Map chrome: MapLibre's own controls, attribution, and popups take square corners like everything else. */
.maplibregl-ctrl-group, .maplibregl-ctrl-group button, .maplibregl-ctrl-attrib, .maplibregl-compact-show,
.maplibregl-ctrl-scale, .maplibregl-popup-content { border-radius: 0 !important; }
