/* Reset and element defaults. No classes here: components style themselves. */

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

  body,
  h1,
  h2,
  h3,
  h4,
  p,
  ol,
  ul,
  figure {
    margin: 0;
  }

  ol,
  ul {
    padding: 0;
    list-style: none;
  }

  img,
  svg {
    display: block;
    max-width: 100%;
  }

  button,
  input,
  select,
  textarea {
    font: inherit;
    color: inherit;
  }
}

@layer base {
  body {
    min-width: var(--page-min-width);
    font: var(--type-body);
    color: var(--text);
    background: var(--ground);
    -webkit-font-smoothing: antialiased;
  }

  a {
    color: inherit;
  }

  :focus-visible {
    outline: var(--stroke-rule) solid var(--focus-ring);
    outline-offset: var(--stroke-rule);
  }

  /* Copy for one input only (core/js/input.js); !important, like [hidden], so no
     component's display brings it back. */
  :root[data-input="touch"] [data-input-only="mouse"],
  :root:not([data-input="touch"]) [data-input-only="touch"] {
    display: none !important;
  }

  /*
   * With touch, small controls get an invisible hit area of at least 44px (Apple's
   * minimum), centred on them; they look the same. The page is drawn 1440px wide, so a
   * tablet shows it smaller still. In this layer, a component's own position (absolute)
   * wins over the relative here. Left out: controls packed so close that hit areas would
   * overlap (section 5's time slots) and range inputs, which take no pseudo-element.
   */
  :root[data-input="touch"]
    :is(
      .button,
      .network__expand,
      .network__layout-option,
      .popup__close,
      .notice__close,
      .slots__step,
      .routine__toggle,
      .routine__delete,
      .add,
      .status__button,
      .scrollbar__arrow
    ) {
    position: relative;
  }

  :root[data-input="touch"]
    :is(
      .button,
      .network__expand,
      .network__layout-option,
      .popup__close,
      .notice__close,
      .slots__step,
      .routine__toggle,
      .routine__delete,
      .add,
      .status__button,
      .scrollbar__arrow
    )::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: max(100%, 44px);
    height: max(100%, 44px);
    transform: translate(-50%, -50%);
  }
}
