/*! fields.css 1.0.0 | DJ2000-UK/app-workbench
 *
 * Date and time fields that fit their box on an iPhone; see docs/FIELDS.md.
 *
 * iOS draws input type="date", "time", "datetime-local", "month" and "week" as
 * a native button unless appearance is none. That native look sizes the box
 * itself: content-box sizing (so width: 100% plus padding runs past its
 * column), a minimum width as wide as the longest date in its font (whatever
 * min-width the page sets), a taller minimum height, and the value centred.
 * In a row of two fields the date ran over the field beside it, and on its
 * own it ran past the sheet's edge (Kaizen's new counter sheet, 2026-11-30).
 * Chromium draws none of this, so desktop tests miss it; the browser check
 * noOverlaps() in template/tests/helpers.mjs copies the iPhone rules to find it.
 *
 * With appearance none, iOS leaves the field to the page: the app's own field
 * style (border, radius, padding, height) applies as to a text field, the date
 * sits on the left like any other value, and tapping still opens the iPhone's
 * date wheel. The value keeps one line of height, so an empty field does not
 * collapse. display is left alone: iOS centres the value in a flex box, and a
 * display: block of our own would lose that (WebKit bug 139848).
 *
 * The layer, djcns-fields, is the app's to override: load this stylesheet
 * straight after zoom/no-zoom.css, before the app's own, so it is declared
 * second and stays weaker than everything the app sets.
 */
@layer djcns-fields {
  input:is([type="date"], [type="time"], [type="datetime-local"], [type="month"], [type="week"]) {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
  }
  input:is([type="date"], [type="time"], [type="datetime-local"], [type="month"], [type="week"])::-webkit-date-and-time-value {
    min-height: 1.2em;
    min-height: 1lh;
    margin: 0;
    text-align: start;
  }
  input:is([type="date"], [type="time"], [type="datetime-local"], [type="month"], [type="week"])::-webkit-datetime-edit,
  input:is([type="date"], [type="time"], [type="datetime-local"], [type="month"], [type="week"])::-webkit-datetime-edit-fields-wrapper {
    padding: 0;
  }
  input:is([type="date"], [type="time"], [type="datetime-local"], [type="month"], [type="week"])::-webkit-calendar-picker-indicator {
    margin-block: 0;
    padding-block: 0;
  }
}
