/*
 * M3 component layer.
 *
 * Pure CSS, no JavaScript, no build step. Load a token file first, then this.
 * Every color is a var(--md-sys-color-*) role and every radius is a
 * var(--md-sys-shape-corner-*) token, so a page restyles entirely by swapping
 * the token file underneath it.
 *
 * Per-component values come from research/m3-components.md, tagged by origin.
 * Where material-web and androidx disagree, this file follows material-web,
 * and the disagreement is noted at the point it matters.
 *
 * Two deliberate departures from stock M3, both accessibility calibration for
 * an elderly, frequently low vision audience, documented in
 * references/accessibility.md:
 *   1. Touch floor is 48px, not M3's 40dp component height. Anything a finger
 *      lands on is at least 48px, either by min-height or by an invisible
 *      ::before expander on controls that must stay visually small.
 *   2. Body text floor is 18px. The token file carries that; this layer only
 *      ever references typescale roles, so it inherits the floor.
 */

/* ==========================================================================
   Elevation and motion
   ==========================================================================
   The generator emits color, shape, type and state tokens. It does not emit
   elevation or motion, because neither is derived from the brand seed. They
   are fixed M3 values, so they live here.

   Two stacked shadows per level: key shadow at 30% and ambient at 15% of
   --md-sys-color-shadow. color-mix is used rather than rgba() so the shadow
   color stays a token and no raw color literal enters this file.
   [MW elevation/internal/_elevation.scss]
*/

:root {
  --md-sys-elevation-level0: none;
  --md-sys-elevation-level1:
    0 1px 2px 0 color-mix(in srgb, var(--md-sys-color-shadow) 30%, transparent),
    0 1px 3px 1px color-mix(in srgb, var(--md-sys-color-shadow) 15%, transparent);
  --md-sys-elevation-level2:
    0 1px 2px 0 color-mix(in srgb, var(--md-sys-color-shadow) 30%, transparent),
    0 2px 6px 2px color-mix(in srgb, var(--md-sys-color-shadow) 15%, transparent);
  --md-sys-elevation-level3:
    0 1px 3px 0 color-mix(in srgb, var(--md-sys-color-shadow) 30%, transparent),
    0 4px 8px 3px color-mix(in srgb, var(--md-sys-color-shadow) 15%, transparent);
  --md-sys-elevation-level4:
    0 2px 3px 0 color-mix(in srgb, var(--md-sys-color-shadow) 30%, transparent),
    0 6px 10px 4px color-mix(in srgb, var(--md-sys-color-shadow) 15%, transparent);
  --md-sys-elevation-level5:
    0 4px 4px 0 color-mix(in srgb, var(--md-sys-color-shadow) 30%, transparent),
    0 8px 12px 6px color-mix(in srgb, var(--md-sys-color-shadow) 15%, transparent);

  --md-sys-motion-duration-short2: 100ms;
  --md-sys-motion-duration-short4: 200ms;
  --md-sys-motion-duration-medium2: 300ms;
  --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1);

  /* Disabled is universal across every component. [MW, consistent everywhere] */
  --md-sys-state-disabled-container-opacity: 0.12;
  --md-sys-state-disabled-content-opacity: 0.38;
}

/* ==========================================================================
   Shared mechanisms
   ========================================================================== */

/*
 * State layer. A pseudo-element wash over the container, never a change to the
 * container's own background, so the resting color stays exactly the token
 * value and hover/focus/pressed compose predictably on top of it.
 *
 * Opacities are 8 / 12 / 12 / 16. androidx tightened focus and pressed to 10%
 * during the Expressive cycle; material-web has not adopted that, and neither
 * do we. Fallbacks are inlined so a component still reads correctly if a page
 * loads this file without a token file.
 */
.m3-button,
.m3-icon-button,
.m3-fab,
.m3-chip,
.m3-card--interactive,
.m3-select,
.m3-list-item {
  position: relative;
  isolation: isolate;
}

.m3-button::after,
.m3-icon-button::after,
.m3-fab::after,
.m3-chip::after,
.m3-card--interactive::after,
.m3-select::after,
.m3-list-item::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--md-sys-motion-duration-short2, 100ms) linear;
}

.m3-button:hover::after,
.m3-icon-button:hover::after,
.m3-fab:hover::after,
.m3-chip:hover::after,
.m3-card--interactive:hover::after,
.m3-select:hover::after,
.m3-list-item:hover::after {
  opacity: var(--md-sys-state-hover-opacity, 0.08);
}

.m3-button:focus-visible::after,
.m3-icon-button:focus-visible::after,
.m3-fab:focus-visible::after,
.m3-chip:focus-visible::after,
.m3-card--interactive:focus-visible::after,
.m3-select:focus-visible::after,
.m3-list-item:focus-visible::after {
  opacity: var(--md-sys-state-focus-opacity, 0.12);
}

.m3-button:active::after,
.m3-icon-button:active::after,
.m3-fab:active::after,
.m3-chip:active::after,
.m3-card--interactive:active::after,
.m3-select:active::after,
.m3-list-item:active::after {
  opacity: var(--md-sys-state-pressed-opacity, 0.12);
}

/*
 * Focus ring. 3px at 2px offset in the secondary role.
 * [MW focus/internal/_focus-ring.scss] This clears WCAG 2.2 SC 2.4.13, which
 * asks for 2px minimum at 3:1 against adjacent colors.
 */
.m3-button:focus-visible,
.m3-icon-button:focus-visible,
.m3-fab:focus-visible,
.m3-chip:focus-visible,
.m3-card--interactive:focus-visible,
.m3-select:focus-visible,
.m3-field__input:focus-visible,
.m3-field__textarea:focus-visible,
.m3-checkbox:focus-visible,
.m3-radio:focus-visible,
.m3-switch:focus-visible,
.m3-list-item:focus-visible,
/*
 * Two bare element selectors, deliberately. A link and a <summary> are
 * interactive whether or not anyone gave them a class, and the standard says
 * every interactive element carries a focus ring. Leaving these to the page
 * means every page reimplements them or, far more likely, forgets. The
 * computed pass checks both, so forgetting is a build failure rather than a
 * silent accessibility hole.
 */
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--md-sys-color-secondary);
  outline-offset: 2px;
}

/*
 * Touch target expander. For controls whose visible box must stay smaller than
 * the 48px floor: checkbox, radio, switch. Invisible, hit testable, and it does
 * not change layout. [MW button/internal/_touch-target.scss]
 */
.m3-checkbox,
.m3-radio,
.m3-switch {
  position: relative;
}

.m3-checkbox::before,
.m3-radio::before,
.m3-switch::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  inline-size: max(48px, 100%);
  block-size: max(48px, 100%);
  transform: translate(-50%, -50%);
}

/* ==========================================================================
   Buttons
   ==========================================================================
   M3 ships a 40dp button. We floor at 48px for the touch target instead.
   Shape is corner-full, label is label-large, icon is 18px. [MW]
*/

.m3-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  min-width: 64px;
  padding-inline: 24px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  background: none;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--md-sys-font-body);
  font-size: var(--md-sys-typescale-label-large-size);
  line-height: var(--md-sys-typescale-label-large-line-height);
  font-weight: var(--md-sys-typescale-label-large-weight);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
  transition:
    box-shadow var(--md-sys-motion-duration-short4, 200ms) var(--md-sys-motion-easing-standard),
    border-radius var(--md-sys-motion-duration-short4, 200ms) var(--md-sys-motion-easing-standard);
}

.m3-button__icon {
  inline-size: 18px;
  block-size: 18px;
  flex: none;
}

.m3-button--filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.m3-button--filled:hover {
  box-shadow: var(--md-sys-elevation-level1);
}

.m3-button--tonal {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.m3-button--tonal:hover {
  box-shadow: var(--md-sys-elevation-level1);
}

.m3-button--elevated {
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-primary);
  box-shadow: var(--md-sys-elevation-level1);
}

.m3-button--elevated:hover {
  box-shadow: var(--md-sys-elevation-level2);
}

.m3-button--outlined {
  background: transparent;
  color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-outline);
}

.m3-button--text {
  background: transparent;
  color: var(--md-sys-color-primary);
  padding-inline: 12px;
}

/*
 * Expressive shape morph. The pill squishes to a rounded rectangle for the
 * duration of the press, then springs back. [AX, round mode, small size]
 */
.m3-button:active {
  border-radius: var(--md-sys-shape-corner-small);
}

.m3-button:disabled,
.m3-button[aria-disabled="true"] {
  cursor: default;
  box-shadow: none;
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent);
}

.m3-button--outlined:disabled,
.m3-button--text:disabled {
  background: transparent;
  border-color: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent);
}

.m3-button:disabled::after {
  opacity: 0;
}

/* ==========================================================================
   Icon button
   ==========================================================================
   40dp visible in M3, floored to 48px here so the visible box is the target.
*/

.m3-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 48px;
  padding: 12px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
}

.m3-icon-button__icon {
  inline-size: 24px;
  block-size: 24px;
}

.m3-icon-button--filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.m3-icon-button--tonal {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.m3-icon-button--outlined {
  border: 1px solid var(--md-sys-color-outline);
}

/* ==========================================================================
   FAB
   ==========================================================================
   Regular 56dp and large 96dp only. M3's 40dp small FAB is deliberately not
   shipped: it cannot meet the 48px touch floor without growing into the
   regular size, so it would be the regular FAB under a misleading name.
*/

.m3-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
  min-width: 56px;
  padding: 16px;
  border: none;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  box-shadow: var(--md-sys-elevation-level3);
  cursor: pointer;
  font-family: var(--md-sys-font-body);
  font-size: var(--md-sys-typescale-label-large-size);
  line-height: var(--md-sys-typescale-label-large-line-height);
  font-weight: var(--md-sys-typescale-label-large-weight);
}

.m3-fab:hover {
  box-shadow: var(--md-sys-elevation-level4);
}

.m3-fab--large {
  min-height: 96px;
  min-width: 96px;
  border-radius: var(--md-sys-shape-corner-extra-large);
}

.m3-fab--extended {
  padding-inline: 16px;
}

.m3-fab__icon {
  inline-size: 24px;
  block-size: 24px;
  flex: none;
}

/* ==========================================================================
   Text fields
   ==========================================================================
   56dp container, 16dp padding, body-large input text, 4dp gap to supporting
   text. Filled rounds the top corners only, so the active indicator line sits
   on a square bottom edge. Outlined rounds all four. [AX + MW field/internal]

   The label is a real <label for>, always. The floated position is done with a
   transform on :focus-within and on :not(:placeholder-shown), which is why the
   input needs placeholder=" " in the markup.
*/

.m3-field {
  position: relative;
  display: flex;
  flex-direction: column;
}

.m3-field__input,
.m3-field__textarea {
  min-height: 56px;
  padding: 24px 16px 8px;
  border: none;
  border-block-end: 1px solid var(--md-sys-color-on-surface-variant);
  border-start-start-radius: var(--md-sys-shape-corner-extra-small);
  border-start-end-radius: var(--md-sys-shape-corner-extra-small);
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
  caret-color: var(--md-sys-color-primary);
  font-family: var(--md-sys-font-body);
  font-size: var(--md-sys-typescale-body-large-size);
  line-height: var(--md-sys-typescale-body-large-line-height);
}

.m3-field__input:focus,
.m3-field__textarea:focus {
  border-block-end-width: 2px;
  border-block-end-color: var(--md-sys-color-primary);
  outline-offset: 2px;
}

.m3-field__label {
  position: absolute;
  inset-block-start: 16px;
  inset-inline-start: 16px;
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--md-sys-font-body);
  font-size: var(--md-sys-typescale-body-large-size);
  line-height: var(--md-sys-typescale-body-large-line-height);
  pointer-events: none;
  transform-origin: left top;
  transition: transform var(--md-sys-motion-duration-short4, 200ms) var(--md-sys-motion-easing-standard);
}

.m3-field__input:focus + .m3-field__label,
.m3-field__input:not(:placeholder-shown) + .m3-field__label,
.m3-field__textarea:focus + .m3-field__label,
.m3-field__textarea:not(:placeholder-shown) + .m3-field__label {
  transform: translateY(-12px) scale(0.75);
  color: var(--md-sys-color-primary);
}

.m3-field__supporting {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 16px 0;
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--md-sys-font-body);
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: var(--md-sys-typescale-body-small-line-height);
}

/*
 * Outlined variant. All four corners rounded, a real border rather than a
 * bottom indicator. The notch that M3 cuts into the outline behind the floated
 * label is done here with a background patch on the label, which is the same
 * trick material-web uses when it is not using a fieldset legend.
 */
.m3-field--outlined .m3-field__input,
.m3-field--outlined .m3-field__textarea {
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-extra-small);
  background: transparent;
  padding: 16px;
}

.m3-field--outlined .m3-field__input:focus,
.m3-field--outlined .m3-field__textarea:focus {
  border-width: 2px;
  border-color: var(--md-sys-color-primary);
}

.m3-field--outlined .m3-field__input:focus + .m3-field__label,
.m3-field--outlined .m3-field__input:not(:placeholder-shown) + .m3-field__label,
.m3-field--outlined .m3-field__textarea:focus + .m3-field__label,
.m3-field--outlined .m3-field__textarea:not(:placeholder-shown) + .m3-field__label {
  transform: translateY(-24px) scale(0.75);
  padding-inline: 4px;
  background: var(--md-sys-color-surface);
}

/*
 * Error state. material-web toggles this with an `error` attribute. Hand rolled
 * CSS has no such hook, so aria-invalid is the switch, which has the useful
 * side effect of making the error announceable rather than only visible.
 */
.m3-field__input[aria-invalid="true"],
.m3-field__textarea[aria-invalid="true"],
.m3-field--outlined .m3-field__input[aria-invalid="true"] {
  border-color: var(--md-sys-color-error);
  caret-color: var(--md-sys-color-error);
}

.m3-field__input[aria-invalid="true"] ~ .m3-field__supporting,
.m3-field__textarea[aria-invalid="true"] ~ .m3-field__supporting {
  color: var(--md-sys-color-error);
}

.m3-field__input:disabled,
.m3-field__textarea:disabled {
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);
  border-color: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent);
}

/* ==========================================================================
   Select
   ==========================================================================
   Shares the text field's box exactly. [AX, filled-select uses filled tokens]
*/

.m3-select {
  min-height: 56px;
  padding: 16px 48px 16px 16px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-extra-small);
  background: transparent;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  appearance: none;
  font-family: var(--md-sys-font-body);
  font-size: var(--md-sys-typescale-body-large-size);
  line-height: var(--md-sys-typescale-body-large-line-height);
}

/* ==========================================================================
   Checkbox, radio, switch
   ==========================================================================
   Visible boxes stay at M3 size. The 48px target comes from the ::before
   expander defined above, so a dense form does not grow by 30px per row.
*/

.m3-checkbox {
  inline-size: 18px;
  block-size: 18px;
  margin: 0;
  accent-color: var(--md-sys-color-primary);
  /* M3 shows roughly a 2px radius here and does not expose it as a token.
     Rounded up to the extra-small step so every radius stays on the scale. */
  border-radius: var(--md-sys-shape-corner-extra-small);
  cursor: pointer;
}

.m3-radio {
  inline-size: 20px;
  block-size: 20px;
  margin: 0;
  accent-color: var(--md-sys-color-primary);
  cursor: pointer;
}

/*
 * Switch. 52x32 track, corner-full, with the handle drawn by the thumb
 * pseudo-element. Checked state relies on :checked, so it needs an
 * <input type="checkbox" class="m3-switch"> and no JavaScript.
 */
.m3-switch {
  appearance: none;
  inline-size: 52px;
  block-size: 32px;
  margin: 0;
  border: 2px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container-highest);
  cursor: pointer;
  transition: background-color var(--md-sys-motion-duration-short4, 200ms) var(--md-sys-motion-easing-standard);
}

.m3-switch::after {
  content: "";
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 4px;
  inline-size: 16px;
  block-size: 16px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-outline);
  transform: translateY(-50%);
  transition: all var(--md-sys-motion-duration-short4, 200ms) var(--md-sys-motion-easing-standard);
}

.m3-switch:checked {
  background: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
}

.m3-switch:checked::after {
  inset-inline-start: 24px;
  inline-size: 24px;
  block-size: 24px;
  background: var(--md-sys-color-on-primary);
}

/* ==========================================================================
   Cards
   ==========================================================================
   corner-medium for all three. M3 exposes no padding token; 16px is the
   convention and it is on the spacing grid.
*/

.m3-card {
  display: block;
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  box-shadow: var(--md-sys-elevation-level1);
}

.m3-card--filled {
  background: var(--md-sys-color-surface-container-highest);
  box-shadow: var(--md-sys-elevation-level0);
}

.m3-card--outlined {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: var(--md-sys-elevation-level0);
}

.m3-card--interactive {
  cursor: pointer;
}

.m3-card--interactive:hover {
  box-shadow: var(--md-sys-elevation-level2);
}

/* ==========================================================================
   Chips
   ==========================================================================
   M3 chips are 32dp tall. Floored to 48px here: a 32dp chip is a tap target
   for a population with reduced dexterity, and the floor is not negotiable.
   Shape stays corner-small, so it still reads as a chip and not a button.
*/

.m3-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding-inline: 16px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-small);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  font-family: var(--md-sys-font-body);
  font-size: var(--md-sys-typescale-label-large-size);
  line-height: var(--md-sys-typescale-label-large-line-height);
  font-weight: var(--md-sys-typescale-label-large-weight);
}

.m3-chip__icon {
  inline-size: 18px;
  block-size: 18px;
}

.m3-chip--selected,
.m3-chip[aria-pressed="true"] {
  border-color: transparent;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.m3-chip--elevated {
  border-color: transparent;
  box-shadow: var(--md-sys-elevation-level1);
}

/* ==========================================================================
   Dialog
   ==========================================================================
   Styles the native <dialog>, so open and close need no JavaScript beyond
   showModal(). corner-extra-large, surface-container-high, level3. [AX]
*/

.m3-dialog {
  max-inline-size: 560px;
  padding: 24px;
  border: none;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  box-shadow: var(--md-sys-elevation-level3);
}

.m3-dialog::backdrop {
  background: color-mix(in srgb, var(--md-sys-color-scrim) 32%, transparent);
}

.m3-dialog__headline {
  margin: 0 0 16px;
  color: var(--md-sys-color-on-surface);
  font-family: var(--md-sys-font-heading);
  font-size: var(--md-sys-typescale-headline-small-size);
  line-height: var(--md-sys-typescale-headline-small-line-height);
  font-weight: var(--md-sys-typescale-headline-small-weight);
}

.m3-dialog__body {
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--md-sys-font-body);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line-height);
}

.m3-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-block-start: 24px;
}

/* ==========================================================================
   Snackbar
   ==========================================================================
   48dp single line, inverse-surface container, inverse-primary action. [AX]
*/

.m3-snackbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-extra-small);
  background: var(--md-sys-color-inverse-surface);
  color: var(--md-sys-color-inverse-on-surface);
  box-shadow: var(--md-sys-elevation-level3);
  font-family: var(--md-sys-font-body);
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: var(--md-sys-typescale-body-medium-line-height);
}

.m3-snackbar__action {
  color: var(--md-sys-color-inverse-primary);
  font-weight: var(--md-sys-typescale-label-large-weight);
}

/* ==========================================================================
   Top app bar
   ==========================================================================
   64dp small bar, flat and surface-colored at rest. On scroll it does not gain
   a shadow hack: it swaps to surface-container and elevation level2, which is
   the actual M3 mechanism. Add .m3-app-bar--scrolled from a scroll listener,
   or leave it off entirely for a static page.
*/

.m3-app-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding-inline: 16px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  box-shadow: var(--md-sys-elevation-level0);
  transition: background-color var(--md-sys-motion-duration-short4, 200ms) var(--md-sys-motion-easing-standard);
}

.m3-app-bar__title {
  margin: 0;
  font-family: var(--md-sys-font-heading);
  font-size: var(--md-sys-typescale-title-large-size);
  line-height: var(--md-sys-typescale-title-large-line-height);
  font-weight: var(--md-sys-typescale-title-large-weight);
}

.m3-app-bar--scrolled {
  background: var(--md-sys-color-surface-container);
  box-shadow: var(--md-sys-elevation-level2);
}

/* ==========================================================================
   Divider, progress, badge
   ========================================================================== */

.m3-divider {
  block-size: 1px;
  margin: 0;
  border: none;
  background: var(--md-sys-color-outline-variant);
}

.m3-divider--inset {
  margin-inline: 16px;
}

/* Linear progress, 4dp track. [MW] */
.m3-progress {
  block-size: 4px;
  inline-size: 100%;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container-highest);
  overflow: hidden;
}

.m3-progress__bar {
  block-size: 100%;
  background: var(--md-sys-color-primary);
  border-radius: inherit;
  transition: inline-size var(--md-sys-motion-duration-medium2, 300ms) var(--md-sys-motion-easing-standard);
}

/*
 * Circular progress, 48dp with a 4dp stroke. The Expressive wavy indicator
 * needs SVG path animation, so it is not offered here.
 */
.m3-progress-circular {
  inline-size: 48px;
  block-size: 48px;
  border: 4px solid var(--md-sys-color-surface-container-highest);
  border-block-start-color: var(--md-sys-color-primary);
  border-radius: var(--md-sys-shape-corner-full);
  animation: m3-spin 1s linear infinite;
}

@keyframes m3-spin {
  to {
    transform: rotate(360deg);
  }
}

.m3-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 16px;
  block-size: 16px;
  padding-inline: 4px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  font-family: var(--md-sys-font-body);
  font-size: var(--md-sys-typescale-label-small-size);
  line-height: var(--md-sys-typescale-label-small-line-height);
  font-weight: var(--md-sys-typescale-label-small-weight);
}

.m3-badge--dot {
  min-inline-size: 6px;
  inline-size: 6px;
  block-size: 6px;
  padding: 0;
}

/* ==========================================================================
   Reduced motion
   ==========================================================================
   Everything above degrades to an instant state change. Nothing in this layer
   depends on an animation to convey meaning, so removing motion removes
   nothing but the motion.
*/

@media (prefers-reduced-motion: reduce) {
  .m3-button,
  .m3-button::after,
  .m3-icon-button::after,
  .m3-fab,
  .m3-fab::after,
  .m3-chip::after,
  .m3-card--interactive,
  .m3-card--interactive::after,
  .m3-select::after,
  .m3-list-item::after,
  .m3-field__label,
  .m3-switch,
  .m3-switch::after,
  .m3-app-bar,
  .m3-progress__bar {
    transition: none;
  }

  .m3-progress-circular {
    animation: none;
  }
}
