/* Shared page bounds for every service-site page, including standalone LPs.
   Descendant tables and other local scroll regions keep their own scrolling. */
html,
body {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Prefer complete Japanese phrases; explicit diagrams and controls keep their own layout. */
:where(h1, h2, h3, h4, summary) {
  text-wrap: balance;
  word-break: auto-phrase;
}
:where(p) {
  word-break: auto-phrase;
  text-wrap: pretty;
}
.text-phrase {
  display: inline-block;
  max-width: 100%;
}

/* Form controls use the same outline with a page-specific accent. */
[data-field-focus="drivex"] { --field-focus-color: #d846a5; }
[data-field-focus="drivegs"] { --field-focus-color: #008f85; }
[data-field-focus="materials"] { --field-focus-color: #75509f; }
[data-field-focus="gold"], [data-field-focus="serviceguide"][data-active="dispatch"] { --field-focus-color: #f4d12d; }
[data-field-focus="serviceguide"][data-active="recruit"] { --field-focus-color: #7049f5; }
[data-field-focus="serviceguide"][data-active="consult"] { --field-focus-color: #008390; }
[data-field-focus="data"] { --field-focus-color: var(--salary-cyan, var(--market-cyan)); }
[data-field-focus] :is(input:not([type="hidden"]), select, textarea):focus,
[data-field-focus] .radio-pill:has(input:focus-visible),
[data-field-focus] .dispatch-service-options input:focus-visible + span {
  outline: 2px solid var(--field-focus-color);
  outline-offset: 2px;

  &:where([data-field-focus="gold"] *, [data-field-focus="serviceguide"][data-active="dispatch"] *) {
    /* Keep the yellow ring distinct on light form surfaces. */
    box-shadow: 0 0 0 1px #263a4a;
  }
}

/* Keep previously shared fragments at the same position as their section. */
:where(section, div):has(> .anchor-alias) { position: relative; }
.anchor-alias { position: absolute; inset-block-start: 0; inset-inline-start: 0; scroll-margin-top: inherit; }
