/* ============================================================================
   Design system — components from the Website / dash.org Figma file

   One shared sheet for every design-system component. It is safe to share
   because every selector here is a `.ds-*` class: linking it restyles
   nothing until markup opts in by using one of these classes. Never add a
   bare element selector (a, button, h1…) or a legacy class (.btn, .row…) —
   that would turn this into another dash.css.

   Values live in `css/tokens.css`, never here: this sheet only says which
   token goes where. Link order: shared sheets → tokens.css → ds.css →
   page-scoped sheet.

   Sections: 1. Text styles  2. Button
   ========================================================================== */


/* --- 1. Text styles ------------------------------------------------------
   Figma Typography page (node 694:5049). Only the styles the markup uses
   today; add the rest of the scale as pages need them.

   A text style carries type only, never spacing. Space between elements is
   the parent's job, via `gap` on a flex/grid container, which is how Figma's
   auto-layout expresses it. Zeroing margins here — rather than on bare h1-h6
   and p — keeps the legacy page flow untouched: 160 of the site's 209 flex
   containers have no `gap`, so a global reset would collapse vertical
   spacing everywhere. */
.ds-xl-semibold,
.ds-l-semibold,
.ds-m-regular,
.ds-m-medium,
.ds-s-regular,
.ds-s-medium,
.ds-h1-extrabold,
.ds-h2-extrabold,
.ds-h3-bold,
.ds-h4-bold,
.ds-h5-bold,
.ds-h6-bold {
  letter-spacing: 0;
  margin: 0;
  padding: 0;
}

.ds-xl-semibold,
.ds-l-semibold,
.ds-m-regular,
.ds-m-medium,
.ds-s-regular,
.ds-s-medium {
  font-family: var(--ds-font-text);
}

/* Heading variants take the heading family, not the text family. */
.ds-h1-extrabold,
.ds-h2-extrabold,
.ds-h3-bold,
.ds-h4-bold,
.ds-h5-bold,
.ds-h6-bold {
  font-family: var(--ds-font-heading);
}

.ds-h1-extrabold {
  font-size: var(--ds-h1-size);
  line-height: var(--ds-h1-lh);
  font-weight: var(--ds-fw-extrabold);
}

.ds-h2-extrabold {
  font-size: var(--ds-h2-size);
  line-height: var(--ds-h2-lh);
  font-weight: var(--ds-fw-extrabold);
}

.ds-h3-bold {
  font-size: var(--ds-h3-size);
  line-height: var(--ds-h3-lh);
  font-weight: var(--ds-fw-bold);
}

.ds-h4-bold {
  font-size: var(--ds-h4-size);
  line-height: var(--ds-h4-lh);
  font-weight: var(--ds-fw-bold);
}

.ds-h6-bold {
  font-size: var(--ds-h6-size);
  line-height: var(--ds-h6-lh);
  font-weight: var(--ds-fw-bold);
}

.ds-xl-semibold {
  font-size: var(--ds-xl-size);
  line-height: var(--ds-xl-lh);
  font-weight: var(--ds-fw-semibold);
}

.ds-l-semibold {
  font-size: var(--ds-l-size);
  line-height: var(--ds-l-lh);
  font-weight: var(--ds-fw-semibold);
}

.ds-h5-bold {
  font-size: var(--ds-h5-size);
  line-height: var(--ds-h5-lh);
  font-weight: var(--ds-fw-bold);
}

.ds-m-regular {
  font-size: var(--ds-m-size);
  line-height: var(--ds-m-lh);
  font-weight: var(--ds-fw-regular);
}

.ds-m-medium {
  font-size: var(--ds-m-size);
  line-height: var(--ds-m-lh);
  font-weight: var(--ds-fw-medium);
}

.ds-s-regular {
  font-size: var(--ds-s-size);
  line-height: var(--ds-s-lh);
  font-weight: var(--ds-fw-regular);
}

.ds-s-medium {
  font-size: var(--ds-s-size);
  line-height: var(--ds-s-lh);
  font-weight: var(--ds-fw-medium);
}

/* The class is written twice on purpose. dash.css colours headings through
   section classes — `.bg-white h2`, `.bg-light h3` … (0,1,1) — which outrank
   a single class (0,1,0) and turned a `.ds-text-primary` h2 Dash blue.
   Doubling it gives (0,2,0): enough to win, still below any ID rule, and no
   !important. */
.ds-text-primary.ds-text-primary   { color: var(--ds-text-primary); }
.ds-text-tertiary.ds-text-tertiary { color: var(--ds-text-tertiary); }


/* --- 2. Button -----------------------------------------------------------
   Figma components btn--lg / btn--md / btn--sm (page "|–– Button").
   A button is built from three classes — base, size, style:

     <a class="ds-btn ds-btn--lg ds-btn--filled-blue" href="…">
       <span class="ds-btn__icon">…</span>      optional, Leading icon
       Label
       <span class="ds-btn__icon">…</span>      optional, Trailing icon
     </a>

   Works on <a> and <button> alike. Always pair .ds-btn with exactly one
   size class; the size classes are what fill in the --_btn-* slots below.

   Width: the button hugs its label, as in Figma. To stretch it or cap it,
   set width / max-width from the CONTEXT (the section's own sheet), not by
   adding a size variant here — e.g. `.hero .ds-btn { width: 100%;
   max-width: 320px; }`. The content stays centred when stretched.

   Sizes follow the Figma modes through the tokens, so the same class is
   56px tall on desktop and 50px on mobile with no media query here. */
.ds-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--_btn-gap);
  padding: var(--_btn-padding-vertical) var(--_btn-padding-horizontal);
  border: 0;
  border-radius: var(--_btn-radius);
  background-color: var(--_btn-bg, transparent);
  color: var(--_btn-content);
  /* Figma strokes sit INSIDE the box, so a stroked button is the same 56px
     as a filled one. A CSS border would add 2px; an inset shadow draws the
     same 1px line without changing the size. */
  box-shadow: inset 0 0 0 1px var(--_btn-stroke, transparent);
  font-family: var(--ds-font-text);
  font-size: var(--_btn-font-size);
  line-height: var(--_btn-line-height);
  font-weight: var(--_btn-font-weight);
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  /* dash.css gives every <a> `transition: all 0.5s`, which would animate the
     padding when a mode switches. Name only what a state change may fade. */
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

/* `a:hover` in dash.css / bootstrap-rtl.css (0,1,1) outranks `.ds-btn`
   (0,1,0) and would turn the label blue and underline it. This restates
   both at (0,2,0). Figma defines no hover state yet; when it does, the
   style classes set different slot values under :hover. */
.ds-btn:hover,
.ds-btn:focus {
  color: var(--_btn-content);
  text-decoration: none;
}

/* Icon slot: as tall as the label's line, so an icon of any size centres on
   the text. The icon keeps its own width/height. Draw SVG icons with
   `currentColor` so they take the style's content colour, as in Figma. */
.ds-btn__icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  height: var(--_btn-line-height);
}

/* Sizes — each maps one Figma variable group onto the slots above. */
.ds-btn--lg {
  --_btn-font-size: var(--ds-button-large-font-size);
  --_btn-line-height: var(--ds-button-large-line-height);
  --_btn-font-weight: var(--ds-button-large-font-weight);
  --_btn-gap: var(--ds-button-large-gap);
  --_btn-padding-horizontal: var(--ds-button-large-padding-horizontal);
  --_btn-padding-vertical: var(--ds-button-large-padding-vertical);
  --_btn-radius: var(--ds-button-large-radius);
}

.ds-btn--md {
  --_btn-font-size: var(--ds-button-medium-font-size);
  --_btn-line-height: var(--ds-button-medium-line-height);
  --_btn-font-weight: var(--ds-button-medium-font-weight);
  --_btn-gap: var(--ds-button-medium-gap);
  --_btn-padding-horizontal: var(--ds-button-medium-padding-horizontal);
  --_btn-padding-vertical: var(--ds-button-medium-padding-vertical);
  --_btn-radius: var(--ds-button-medium-radius);
}

.ds-btn--sm {
  --_btn-font-size: var(--ds-button-small-font-size);
  --_btn-line-height: var(--ds-button-small-line-height);
  --_btn-font-weight: var(--ds-button-small-font-weight);
  --_btn-gap: var(--ds-button-small-gap);
  --_btn-padding-horizontal: var(--ds-button-small-padding-horizontal);
  --_btn-padding-vertical: var(--ds-button-small-padding-vertical);
  --_btn-radius: var(--ds-button-small-radius);
}

/* Styles — Figma "Button > Styles" (node 3355:17519). Each fills the colour
   slots; an unset slot means none (no fill, no stroke). Plain styles keep
   their padding, so they line up with filled buttons beside them.
   Light backgrounds: filled-blue, filled-white, tinted-gray, stroke-black,
   stroke-gray, plain-black, plain-blue. Dark: tinted-white, stroke-white. */
.ds-btn--filled-blue {
  --_btn-bg: var(--ds-button-filled-blue-bg);
  --_btn-content: var(--ds-button-filled-blue-content);
}

.ds-btn--filled-white {
  --_btn-bg: var(--ds-button-filled-white-bg);
  --_btn-content: var(--ds-button-filled-white-content);
}

.ds-btn--tinted-gray {
  --_btn-bg: var(--ds-button-tinted-gray-bg);
  --_btn-content: var(--ds-button-tinted-gray-content);
}

.ds-btn--tinted-white {
  --_btn-bg: var(--ds-button-tinted-white-bg);
  --_btn-content: var(--ds-button-tinted-white-content);
}

.ds-btn--stroke-black {
  --_btn-stroke: var(--ds-button-stroke-black-stroke);
  --_btn-content: var(--ds-button-stroke-black-content);
}

.ds-btn--stroke-gray {
  --_btn-stroke: var(--ds-button-stroke-gray-stroke);
  --_btn-content: var(--ds-button-stroke-gray-content);
}

.ds-btn--stroke-white {
  --_btn-stroke: var(--ds-button-stroke-white-stroke);
  --_btn-content: var(--ds-button-stroke-white-content);
}

.ds-btn--plain-black {
  --_btn-content: var(--ds-button-plain-black-content);
}

.ds-btn--plain-blue {
  --_btn-content: var(--ds-button-plain-blue-content);
}
