:root {
  --mt-slate-mobile-max: 900px;
  --mt-slate-desktop-canvas: 1360px;
  --mt-slate-desktop-content: 1200px;
  --mt-slate-desktop-scroll-floor: 1360px;
  --mt-slate-button-label-padding: 8px;
  --mt-slate-button-raised:
    inset 0 1px 1.8px rgb(255 255 255 / 54%),
    inset 0 -1.5px 2px rgb(17 29 25 / 31%),
    inset -.75px 0 1.2px rgb(255 255 255 / 36%),
    inset 1px 0 1.6px rgb(17 29 25 / 22%);
  --mt-slate-button-pressed:
    inset 0 2px 3.5px rgb(19 45 60 / 45%),
    inset 0 -1px 1.4px rgb(255 255 255 / 58%),
    inset -1.5px 0 2.6px rgb(19 45 60 / 28%),
    inset 1px 0 1.4px rgb(255 255 255 / 44%),
    inset 0 0 0 999px rgb(19 45 60 / 13%);
}

/* The same edge proportions with quieter highlights on the dark rails. */
:where(.rail, .bo-rail, .mts-editorial-rail, .mts-rail-menu) {
  --mt-slate-button-raised:
    inset 0 1px 1.8px rgb(231 241 250 / 24%),
    inset 0 -1.5px 2px rgb(4 10 15 / 46%),
    inset -.75px 0 1.2px rgb(231 241 250 / 18%),
    inset 1px 0 1.6px rgb(4 10 15 / 35%);
  --mt-slate-button-pressed:
    inset 0 2px 3.5px rgb(4 10 15 / 70%),
    inset 0 -1px 1.4px rgb(231 241 250 / 24%),
    inset -1.5px 0 2.6px rgb(4 10 15 / 40%),
    inset 1px 0 1.4px rgb(231 241 250 / 17%),
    inset 0 0 0 999px rgb(4 10 15 / 16%);
}

/* Paint the bevel on the face so its corners follow the button's own shape. */
@layer mt-slate-button-surface {
  @media (forced-colors: none) {
    :where(
      button, input:is([type="button"], [type="submit"], [type="reset"]),
      [role="button"], [role="tab"], [data-mt-button],
      a:is(.btn, .button, .pressable, .workspace-home-link, .co-link, .mts-commerce-cta, .mts-consultation-cta)
    ):not(:where(
      .sr-only, .visually-hidden, [data-mt-button="plain"],
      :is(footer, [role="contentinfo"]) :is(a, [role="link"], :is(nav, [role="navigation"]) :is(button, [role="button"]))
    )) {
      --mt-slate-button-face: var(--mt-slate-button-raised);
      /* Local themes can flatten shadows. The inset is shared across products. */
      box-shadow: var(--mt-slate-button-face) !important;
      background-clip: padding-box !important;

      /* Local padding keeps compact icon controls and existing wider buttons in proportion. */
      &:not(:where([aria-label]:has(> :is(svg, img, i):only-child), [data-mt-button="icon"])) {
        padding-inline: var(--mt-slate-button-label-padding);
      }

      &:is([aria-pressed="true"], [aria-selected="true"]) {
        box-shadow: inset 0 -2px currentColor, var(--mt-slate-button-face) !important;
      }

      &:focus-visible {
        outline: 2px solid currentColor !important;
        outline-offset: 2px;
      }

      &:not(:where(:disabled, [aria-disabled="true"], [inert] *)):active {
        --mt-slate-button-face: var(--mt-slate-button-pressed);
        transition-duration: 0s;
      }

      @media (prefers-reduced-motion: no-preference) {
        transition: box-shadow 100ms ease-out;
      }
    }
  }

  /* Footer destinations and link-like navigation controls use flat text. */
  :where(footer, [role="contentinfo"]) :where(a, [role="link"], :is(nav, [role="navigation"]) :is(button, [role="button"])) {
    box-shadow: none !important;
  }

  :where(footer, [role="contentinfo"]) :where(a, [role="link"], :is(nav, [role="navigation"]) :is(button, [role="button"])):focus-visible {
    outline: 2px solid currentColor !important;
    outline-offset: 2px;
  }
}

[data-mt-viewport-contract] {
  container-name: mt-slate-viewport;
  container-type: inline-size;
}

/*
 * Transactional, informational, and dashboard surfaces use the available
 * viewport instead of inheriting the frozen editorial landing canvas.
 * Their outer shell stays in one viewport on desktop; individual work areas
 * may own overflow when their content cannot be compacted any further.
 */
[data-mt-viewport-mode="adaptive-shell"] {
  --mt-shell-inline-gutter: clamp(20px, 3.25vw, 56px);
  --mt-shell-block-gutter: clamp(12px, 2.2dvh, 28px);
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

/*
 * A forced desktop view keeps its authored geometry down to the 1360px
 * readability floor. Below that floor the document scrolls horizontally;
 * individual components do not switch grids, resize type, or hide controls.
 * Above that floor, full-bleed surfaces may grow but their centered internal
 * canvas must keep the same geometry.
 */
@media (min-width: 901px) and (max-width: 1359px) {
  html:has([data-mt-viewport-contract]),
  body:has([data-mt-viewport-contract]),
  #root:has([data-mt-viewport-contract]) {
    min-width: var(--mt-slate-desktop-scroll-floor) !important;
  }

  html:has([data-mt-viewport-contract]),
  body:has([data-mt-viewport-contract]) {
    overflow-x: auto !important;
  }

  #root:has([data-mt-viewport-contract]) {
    overflow-x: visible !important;
  }

  [data-mt-viewport-contract] {
    width: var(--mt-slate-desktop-scroll-floor) !important;
    min-width: var(--mt-slate-desktop-scroll-floor) !important;
  }

  [data-mt-viewport-contract].bo-shell,
  [data-mt-viewport-contract].mt-slate-app-shell {
    position: absolute !important;
    inset: 0 auto auto 0 !important;
  }

  html:has([data-mt-viewport-mode="adaptive-shell"]),
  body:has([data-mt-viewport-mode="adaptive-shell"]),
  #root:has([data-mt-viewport-mode="adaptive-shell"]) {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html:has([data-mt-viewport-mode="adaptive-shell"]),
  body:has([data-mt-viewport-mode="adaptive-shell"]) {
    overflow-x: hidden !important;
  }

  [data-mt-viewport-mode="adaptive-shell"] {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
}

@media (min-width: 901px) {
  html:has([data-mt-viewport-mode="adaptive-shell"]),
  body:has([data-mt-viewport-mode="adaptive-shell"]),
  #root:has([data-mt-viewport-mode="adaptive-shell"]) {
    height: 100%;
    min-height: 0;
  }

  html:has([data-mt-viewport-mode="adaptive-shell"]),
  body:has([data-mt-viewport-mode="adaptive-shell"]) {
    overflow: hidden;
  }
}

@media (max-width: 900px) {
  html:has([data-mt-viewport-contract]),
  body:has([data-mt-viewport-contract]),
  #root:has([data-mt-viewport-contract]),
  [data-mt-viewport-contract] {
    min-width: 0 !important;
  }

  html:has([data-mt-viewport-contract]),
  body:has([data-mt-viewport-contract]),
  #root:has([data-mt-viewport-contract]) {
    max-width: 100% !important;
    overflow-x: clip !important;
  }
}
