/* Desktop Wide default; explicit Standard and saved reader choices remain available. */

:root,
body[data-md-color-scheme] {
  --header-title-content-rail-offset: 10.67rem;
  --layout-width-control-content-rail-offset: 2rem;
  --layout-width-control-inline-start: 0.25rem;
  --layout-width-control-radius: var(--header-control-radius);
  --layout-width-control-rest-color: var(--header-control-text);
  --layout-width-control-hover-background: var(--header-hover);
  --layout-width-control-hover-color: var(--header-hover-text);
  --layout-width-control-selected-background: var(--header-selected);
  --layout-width-control-selected-color: var(--header-selected-text);
}

.layout-width-toggle {
  align-items: center;
  background-color: var(--header-control-surface);
  border-radius: var(--layout-width-control-radius);
  box-sizing: border-box;
  color: var(--layout-width-control-rest-color);
  cursor: pointer;
  display: none;
  flex: 0 0 auto;
  font-size: 0.64rem;
  gap: 0.25rem;
  height: var(--header-control-height);
  line-height: 1;
  margin-inline: var(--layout-width-control-inline-start) var(--layout-width-control-content-rail-offset);
  outline-color: var(--md-accent-fg-color);
  outline-offset: 0.1rem;
  padding: 0 0.45rem;
  transition: none;
  white-space: nowrap;
}

.layout-width-toggle[aria-pressed="true"] {
  background-color: var(--layout-width-control-selected-background);
  box-shadow: inset 0 -2px 0 var(--header-control-text);
  color: var(--layout-width-control-selected-color);
}

.layout-width-toggle:is(:hover, :focus-visible),
.layout-width-toggle[aria-pressed="true"]:is(:hover, :focus-visible) {
  background-color: var(--layout-width-control-hover-background);
  color: var(--layout-width-control-hover-color);
}

.layout-width-toggle:active,
.layout-width-toggle[aria-pressed="true"]:active {
  background-color: var(--layout-width-control-selected-background);
  color: var(--layout-width-control-selected-color);
}

.layout-width-toggle svg {
  fill: none;
  height: 0.9rem;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 0.9rem;
}

@media screen and (min-width: 60em) {
  .layout-width-toggle {
    display: inline-flex;
  }

  .md-header__title {
    margin-inline-start: var(--header-title-content-rail-offset);
  }

  .md-header__title .md-header__topic {
    transform: none !important;
  }

  .md-header__source {
    flex: 0 0 0.6rem;
    width: 0.6rem;
  }

  html[data-layout-width="wide"] .md-grid,
  html[data-layout-default-width="wide"]:not([data-layout-width="standard"]) .md-grid {
    max-width: calc(100% - 0.5rem);
  }
}

@media print {
  .layout-width-toggle {
    display: none !important;
  }
}
