/* ATELIER 54 — textarea autosize. field-sizing does the whole job in the layout
   pass the engine already runs. No collapsed frame, so no scroll position to lose.
   Baseline newly available (Chromium 2024, Firefox and Safari mid-2026). */

.autosize {
  field-sizing: content;
  display: block; width: 100%; box-sizing: border-box;
  resize: none;                       /* the box sizes itself, a grip would fight it */
  font: var(--text-n1, 13px)/1.5 var(--font-ui, system-ui);
  padding: 10px 12px;
  border: 1px solid var(--gray-7, #c7c7c7);
  border-radius: 6px;
  color: var(--gray-12, #111); background: var(--gray-2, #f6f6f6);

  /* Floor and ceiling still come from min/max-height: 2 and 8 rows of
     1.5 line-height, plus 20px padding and 2px border. Past the ceiling the
     box scrolls instead of growing. */
  min-height: calc(1.5em * 2 + 22px);
  max-height: calc(1.5em * 8 + 22px);
  overflow-y: auto;
}

.autosize:focus-visible { outline: 2px solid var(--accent-9); outline-offset: 2px; }

/* Older installed browsers get the JS fallback, which needs the scrollbar hidden
   until it sets overflow-y itself. */
@supports not (field-sizing: content) {
  .autosize { overflow-y: hidden; }
}
