/* Softcopy component system: Figma 83:589. Opt in at an editor root.
   Native controls keep their events, keyboard behavior and full 42px target.
   Canvas/preview buttons opt out with data-control="specimen". */
.study-surface {
  --sc-ink: #344bc6;
  --sc-muted: #68729b;
  --sc-control-target: 42px;
  --sc-control-visible: 28px;
  --sc-control-inset: calc((var(--sc-control-target) - var(--sc-control-visible)) / 2);
  --sc-control-padding-top: 6px;
  --sc-control-padding-bottom: 8px;
  --sc-control-icon-offset: calc((var(--sc-control-padding-bottom) - var(--sc-control-padding-top)) / 2);
  --sc-control-radius: 0px;
  --sc-focus-radius: 4px;
  --sc-focus-opacity: 40%;
  --sc-focus-ring: color-mix(in srgb, var(--sc-ink) var(--sc-focus-opacity), transparent);
  --sc-selected-ink: #fff;
  --sc-control-hover: color-mix(in srgb, var(--sc-ink) 4%, transparent);
  --sc-control-press: color-mix(in srgb, var(--sc-ink) 8%, transparent);
  --sc-font-heading: var(--sc-font-identity);
  --sc-font-ui: var(--font-funnel-sans), Arial, sans-serif;
  --sc-font-value: var(--sc-font-ui);
  --sc-type-ui: 14px;
  --sc-type-small: 12px;
  --sc-type-heading: 18px;
  --sc-type-field-mobile: 16px;
  --sc-text-ui: 400 var(--sc-type-ui)/21px var(--sc-font-ui);
  --sc-text-small: 400 var(--sc-type-small)/21px var(--sc-font-ui);
  --sc-text-value: 400 var(--sc-type-small)/21px var(--sc-font-value);
  --sc-text-heading: 400 var(--sc-type-heading)/28px var(--sc-font-heading);
  color: var(--sc-ink);
  font: var(--sc-text-ui);
  font-synthesis: none;
}

.study-surface :is(button, input, select, textarea) { color: inherit; font-family: var(--sc-font-ui); }
.study-surface :where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--sc-focus-ring);
  outline-offset: 2px;
  border-radius: var(--sc-focus-radius);
}
.study-surface button:where(:not([data-control="specimen"])) {
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--sc-control-target);
  min-height: var(--sc-control-target);
  min-width: var(--sc-control-target);
  padding: calc(var(--sc-control-inset) + var(--sc-control-padding-top)) 10px calc(var(--sc-control-inset) + var(--sc-control-padding-bottom));
  border: 0;
  border-radius: var(--sc-control-radius);
  background: transparent;
  color: var(--sc-control-label, var(--sc-ink));
  font: 400 var(--sc-type-ui)/14px var(--sc-font-ui);
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}
.study-surface button:where(:not([data-control="specimen"]))::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: var(--sc-control-inset) 0;
  border-radius: var(--sc-control-radius);
  background: var(--sc-control-fill, transparent);
  pointer-events: none;
}
.study-surface button:where(:not([data-control="specimen"])):hover:not(:disabled) {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.study-surface button:where(:not([data-control="specimen"])):hover:not(:disabled)::before {
  background: var(--sc-control-fill-hover, var(--sc-control-fill, var(--sc-control-hover)));
}
.study-surface button:where(:not([data-control="specimen"])):active:not(:disabled)::before {
  background: var(--sc-control-fill-hover, var(--sc-control-fill, var(--sc-control-press)));
}
.study-surface button:where(:not([data-control="specimen"]))[aria-pressed="true"] {
  --sc-control-fill: var(--sc-ink);
  --sc-control-label: var(--sc-selected-ink);
  --sc-control-fill-hover: var(--sc-ink);
}
.study-surface button:where(:not([data-control="specimen"])):focus-visible { outline: none; }
.study-surface button:where(:not([data-control="specimen"])):focus-visible::after {
  content: "";
  position: absolute;
  inset: var(--sc-control-inset) 0;
  border-radius: var(--sc-focus-radius);
  outline: 2px solid var(--sc-focus-ring);
  outline-offset: 2px;
  pointer-events: none;
}
.study-surface button:disabled { opacity: .35; cursor: default; }
.study-surface button > svg { flex-shrink: 0; }
/* Text needs optical padding; icons stay geometrically centered in the surface. */
.study-surface button:where(:not([data-control="specimen"])) > svg,
.study-surface [data-control-icon] { translate: 0 var(--sc-control-icon-offset); }
.study-surface a { display: inline-flex; align-items: center; min-height: var(--sc-control-target); color: inherit; text-decoration: none; }
.study-surface a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.study-surface :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select) {
  box-sizing: border-box;
  height: var(--sc-control-target);
  min-height: var(--sc-control-target);
  min-width: 0;
  max-width: 100%;
  padding: var(--sc-control-inset) 4px;
  border: 0;
  border-radius: var(--sc-control-radius);
  background: transparent;
  font-size: var(--sc-type-ui);
  line-height: 21px;
}
.study-surface select { cursor: pointer; }
.study-surface input[type="number"], .study-surface output { font: var(--sc-text-value); }
/* Values keep their type role even when presented as editable controls. */
.study-surface [data-token] { font-family: var(--sc-font-value); font-size: var(--sc-type-small); }
.study-surface input::placeholder { color: var(--sc-muted); opacity: 1; }
.study-surface input[type="color"] { appearance: none; width: 42px; padding: var(--sc-control-inset) 0; cursor: pointer; }
.study-surface input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.study-surface input[type="color"]::-webkit-color-swatch { border: 0; border-radius: var(--sc-control-radius); }
.study-surface input[type="color"]::-moz-color-swatch { border: 0; border-radius: var(--sc-control-radius); }
.study-surface input[type="range"] { appearance: none; width: 100%; margin: 0; padding-inline: 0; cursor: pointer; accent-color: var(--sc-ink); }
.study-surface input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: color-mix(in srgb, var(--sc-ink) 20%, transparent); border-radius: 2px; }
.study-surface input[type="range"]::-moz-range-track { height: 3px; background: color-mix(in srgb, var(--sc-ink) 20%, transparent); border-radius: 2px; }
.study-surface input[type="range"]::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border: 0; border-radius: 50%; background: var(--sc-ink); }
.study-surface input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--sc-ink); }
.study-surface input:is([type="checkbox"], [type="radio"]) { width: 14px; height: 14px; margin: 0; flex-shrink: 0; accent-color: var(--sc-ink); cursor: pointer; }
.study-surface label:has(> input:is([type="checkbox"], [type="radio"])) { min-height: var(--sc-control-target); cursor: pointer; }
.study-surface summary { min-height: var(--sc-control-target); align-content: center; cursor: pointer; font: var(--sc-text-ui); list-style: none; }
.study-surface summary::-webkit-details-marker { display: none; }
/* Native details retain their expanded state and keyboard behavior. */
.study-surface summary::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 7px; vertical-align: -1px; opacity: .6; background: linear-gradient(currentColor, currentColor) center / 10px 1px no-repeat, linear-gradient(currentColor, currentColor) center / 1px 10px no-repeat; }
.study-surface details[open] > summary::before { background: linear-gradient(currentColor, currentColor) center / 10px 1px no-repeat; }
/* Native fields stay readable without triggering focus zoom on small screens. */
@media (max-width: 700px) {
  .study-surface input:not([type="range"]):not([type="color"]):not([type="checkbox"]):not([type="radio"]),
  .study-surface select, .study-surface select[data-token] { font-size: var(--sc-type-field-mobile); }
}
@media (forced-colors: active) {
  .study-surface button:where(:not([data-control="specimen"]))[aria-pressed="true"] { --sc-control-fill: Highlight; --sc-control-label: HighlightText; --sc-control-fill-hover: Highlight; }
  .study-surface button:where(:not([data-control="specimen"])):focus-visible::after { outline-color: Highlight; }
  .study-surface input[type="range"]::-webkit-slider-thumb { background: ButtonText; }
  .study-surface input[type="range"]::-moz-range-thumb { background: ButtonText; }
}
