/* Shared Windows / Fluent text controls. Load after route and material styles.
   Keep a constant 1px border: the inset focus line adds its second pixel without
   moving text. Compound controls own one outline, including their adornments. */
/* purgecss start ignore */
:root {
  --fluent-font: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --fluent-text: #1a1a1a;
  --fluent-placeholder: #606060;
  --fluent-accent: var(--primary, #2563eb);
  --fluent-fill: rgb(255 255 255 / 70%);
  --fluent-hover: rgb(249 249 249 / 90%);
  --fluent-edge: rgb(0 0 0 / 5.8%);
  --fluent-baseline: rgb(0 0 0 / 44.6%);
  --fluent-disabled: #a1a1a1;
  --fluent-error: #c42b1c;
}

/* Explicit scope keeps this final, shared skin ahead of legacy page selectors.
   Hidden fields, emoji backing textareas, switches, sliders and swatches retain
   their native sizing and behavior. New text fields inherit this automatically. */
:root[data-input-style="fluent"] body[class] :is(
  input:where(:not([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"])),
  textarea:where(:not(.emoji-source)), select, .emoji-editor, .fluent-input-group
) {
  box-sizing: border-box;
  min-width: 0;
  border: 1px solid var(--fluent-validation, var(--fluent-edge));
  border-bottom-color: var(--fluent-validation, var(--fluent-baseline));
  border-radius: var(--control-field-radius, 4px);
  outline: 0;
  color: var(--fluent-text);
  background: var(--fluent-fill);
  box-shadow: none;
  font-family: var(--fluent-font);
  font-weight: 400;
  letter-spacing: normal;
  caret-color: var(--fluent-accent);
  transition: background-color 120ms, border-color 120ms, box-shadow 120ms;
}

:root[data-input-style="fluent"] body[class] :is(input, textarea, select, .emoji-editor, .fluent-input-group):where(:not([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"], .emoji-source, [data-choice])):hover:where(:not(:disabled, [aria-disabled="true"], [readonly], [aria-readonly="true"])) {
  border-color: var(--fluent-validation, var(--fluent-edge));
  border-bottom-color: var(--fluent-validation, var(--fluent-baseline));
  background-color: var(--fluent-hover);
  box-shadow: none;
}

:root[data-input-style="fluent"] body[class] :is(input, textarea, select, .emoji-editor, .fluent-input-group):where(:not([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"], .emoji-source, [data-choice])):focus-within {
  outline: 0;
  border-color: var(--fluent-validation, var(--fluent-edge));
  border-bottom-color: var(--fluent-validation, var(--fluent-accent));
  background-color: var(--white, var(--tone-surface, #fff));
  box-shadow: inset 0 -1px 0 var(--fluent-validation, var(--fluent-accent));
}

/* Browser validation appears after interaction, never on untouched required fields. */
:root[data-input-style="fluent"] :is(.has-error, [aria-invalid="true"], :user-invalid, label:has(> .admin-field-error)) {
  --fluent-validation: var(--fluent-error);
}
:root[data-input-style="fluent"] .fluent-input-group:has(:is([aria-invalid="true"], :user-invalid)) {
  --fluent-validation: var(--fluent-error);
}

:root[data-input-style="fluent"] body[class] :is(input, textarea, select, .emoji-editor):where(:not([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"], .emoji-source)):where([readonly], [aria-readonly="true"]) {
  background-color: var(--tone-soft, #f5f5f5);
  color: var(--tone-muted, #606060);
  cursor: text;
}
:root[data-input-style="fluent"] body[class] :is(input, textarea, select, .emoji-editor):where(:not([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"], .emoji-source)):is(:disabled, [aria-disabled="true"]),
:root[data-input-style="fluent"] body[class] .fluent-input-group:has(input:disabled) {
  border-color: var(--fluent-edge);
  background-color: color-mix(in srgb, var(--tone-surface, rgb(249 249 249)), transparent);
  color: var(--fluent-disabled);
  -webkit-text-fill-color: var(--fluent-disabled);
  box-shadow: none;
  opacity: 1;
  cursor: not-allowed;
}

:root[data-input-style="fluent"] body[class] :is(input, textarea)::placeholder,
:root[data-input-style="fluent"] body[class] .emoji-editor[data-empty="true"]::before {
  color: var(--fluent-placeholder);
  opacity: 1;
  font-weight: 400;
}
:root[data-input-style="fluent"] body[class] :is(input, textarea):disabled::placeholder {
  color: var(--fluent-disabled);
}

/* 32px desktop controls; touch targets expand at narrow widths. */
:root[data-input-style="fluent"] body[class] :is(
  input:where(:not([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"])), select
) {
  min-height: 32px;
  height: var(--fluent-control-height, 32px);
  max-width: 100%;
  padding: 5px 11px;
  font-size: 14px;
  line-height: 20px;
}
:root[data-input-style="fluent"] body[class] :is(textarea:where(:not(.emoji-source)), .emoji-editor) {
  padding: 9px 11px;
  line-height: 1.65;
  scrollbar-width: thin;
  scrollbar-color: #8a8a8a transparent;
}
:root[data-input-style="fluent"] body[class] textarea:where(:not(.emoji-source)) { resize: vertical; }
:root[data-input-style="fluent"] body[class] .emoji-editor { position: relative; }
/* Placeholder copy must not occupy the editable line or move its caret. */
:root[data-input-style="fluent"] body[class] .emoji-editor[data-empty="true"]::before { position: absolute; inset: 9px 11px auto; }

/* purgecss end ignore */
@media (max-width: 700px), (pointer: coarse) {
  :root[data-input-style="fluent"] body[class] .admin-editor-title-block textarea { font-size: 29px; }
  :root[data-input-style="fluent"] body[class] :is(.admin-block-h2, .admin-block-h3) textarea { font-size: 21px; }
  :root[data-input-style="fluent"] body[class] .admin-block-quote textarea { font-size: 18px; }
}
/* Discovery's hero search is one rounded surface that owns a single brand focus line. */
:root[data-input-style="fluent"] body[class] .explore-search.fluent-input-group {
  gap: 12px; padding: 5px 6px 5px 16px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--white); box-shadow: 0 6px 20px color-mix(in srgb, var(--shade-ink, var(--ink)) 5%, transparent);
}
:root[data-input-style="fluent"] body[class] .explore-search.fluent-input-group:hover { border-color: var(--primary-line); background: var(--white); }
:root[data-input-style="fluent"] body[class] .explore-search.fluent-input-group:focus-within {
  border-color: var(--primary); background: var(--white);
  box-shadow: 0 0 0 3px var(--primary-ring), 0 10px 26px color-mix(in srgb, var(--shade-ink, var(--ink)) 7%, transparent);
}
:root[data-input-style="fluent"] body[class] .explore-search > input:not([type="hidden"]) { min-height: 44px; height: 44px; padding-inline: 2px; }
:root[data-input-style="fluent"] body[class] .explore-search > .icon { flex: 0 0 auto; color: var(--primary-readable); }
:root[data-input-style="fluent"] body[class] .explore-search > .ui-button { min-height: 44px; border-radius: 10px; box-shadow: none; }
@media (max-width: 600px) {
  :root[data-input-style="fluent"] body[class] .explore-search.fluent-input-group { gap: 8px; padding: 4px 4px 4px 12px; border-radius: 12px; }
  :root[data-input-style="fluent"] body[class] .explore-search > .ui-button { padding-inline: 12px; }
}

/* purgecss start ignore */
/* Search prefixes, icons and password buttons share the field's focus line. */
:root[data-input-style="fluent"] body[class] .fluent-input-group { min-height: 32px; }
:root[data-input-style="fluent"] body[class] .fluent-input-group > input:not([type="hidden"]) {
  min-height: 30px;
  height: 100%;
  padding: 5px 2px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}
:root[data-input-style="fluent"] body[class] .header-search input { height: 40px; padding-inline: 77px 46px; }
:root[data-input-style="fluent"] body[class] .password-input input { --fluent-control-height: 40px; padding-inline-end: 44px; }
:root[data-input-style="fluent"] body[class] .password-input button { top: 1px; right: 1px; width: 38px; height: 38px; border-radius: 3px; }
:root[data-input-style="fluent"] body[class] .fluent-input-group > :is(.icon, b, span:not(.sr-only)) { color: var(--fluent-placeholder); }
:root[data-input-style="fluent"] body[class] .fluent-input-group > button:where(:not(.ui-button)) { border-radius: 3px; }

/* purgecss end ignore */
/* Preserve document typography and useful writing space. */
:root[data-input-style="fluent"] body[class] .admin-editor-title-block textarea { font-weight: 600; padding: 10px 12px; line-height: 1.3; }
:root[data-input-style="fluent"] body[class] .admin-editor-form :is(textarea.is-code, [data-composer-source-pane] textarea) { font-family: Consolas, "Cascadia Code", monospace; tab-size: 2; }
:root[data-input-style="fluent"] body[class] :is(.admin-block-h2, .admin-block-h3, .admin-block-table th) textarea { font-weight: 600; }
:root[data-input-style="fluent"] body[class] .admin-block-quote textarea { font-family: Georgia, "Songti SC", serif; }

:root[data-input-style="fluent"] input[type="file"]::file-selector-button {
  margin-inline-end: 10px;
  padding: 6px 12px;
  border: 1px solid var(--fluent-edge);
  border-bottom-color: var(--tone-line, #ccc);
  border-radius: 4px;
  color: var(--fluent-text);
  background: var(--tone-surface, #fff);
  font: 14px/20px var(--fluent-font);
  cursor: pointer;
}
:root[data-input-style="fluent"] input[type="file"]:hover::file-selector-button { background: var(--tone-surface, #f9f9f9); }

/* purgecss start ignore */
@media (max-width: 700px), (pointer: coarse) {
  :root[data-input-style="fluent"] body[class] :is(input, select, .fluent-input-group):where(:not([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"])) { min-height: 44px; }
  :root[data-input-style="fluent"] body[class] :is(input, select, textarea, .emoji-editor) { font-size: max(16px, 1em); }
  :root[data-input-style="fluent"] body[class] .fluent-input-group > input:not([type="hidden"]) { min-height: 42px; }
  :root[data-input-style="fluent"] body[class] .password-input button { width: 42px; height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  :root[data-input-style="fluent"] body[class] :is(input, textarea, select, .emoji-editor, .fluent-input-group):where(:not([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"], .emoji-source)) { transition: none; }
}
@media (forced-colors: active) {
  :root[data-input-style="fluent"] body[class] :is(input, textarea, select, .emoji-editor, .fluent-input-group):where(:not([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"], .emoji-source)) { border-color: ButtonText; }
  :root[data-input-style="fluent"] body[class] :is(input, textarea, select, .emoji-editor, .fluent-input-group):where(:not([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"], .emoji-source)):focus-within { outline: 2px solid Highlight; outline-offset: 2px; }
  :root[data-input-style="fluent"] body[class] :is(input, textarea, select, .emoji-editor):where(:not([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"], .emoji-source)):is(:disabled, [aria-disabled="true"]) { border-color: GrayText; color: GrayText; -webkit-text-fill-color: GrayText; }
  :root[data-input-style="fluent"] body[class] .fluent-input-group > input:not([type="hidden"]) { border: 0; outline: 0; }
  :root[data-input-style="fluent"] body[class] select { appearance: auto; background-image: none; }
}
/* purgecss end ignore */

/* Login is one control group: username, password and its adornment use 44px. */
:root[data-input-style="fluent"] body[class] .interaction-login input { --fluent-control-height: 44px; min-height: 44px; height: 44px; }
:root[data-input-style="fluent"] body[class] .interaction-login .password-input button { inset-block-start: 0; inset-inline-end: 0; width: 44px; height: 44px; }
