/* Keel's controls (Jess, 23 Nov 2026: "nothing looks like a browser default"; DESIGN.md, No browser-default controls).
   One file, the same in house/ and ops/ (tests/controls_styled.py checks the two copies match and that every page
   links it). Loaded last on every page, so it wins over a page's older rules for the same control.

   Navy (Keel's ink, #16263d) for a ticked box and a chosen radio; the border of a text field round an empty one;
   a navy ring, never the browser's blue, when a control is reached by the keyboard. A tick box is the one on Settings (Jess,
   23 Nov 2026): 18 pixels, ink filled with a white tick; its label is the tap area, at least 44 pixels high. tests/screens/lib.js checks every visible input, select
   and textarea a screen test meets carries --keel-control, so a page without this file fails the Deploy. */

:root{
  --kc-ink:#16263d;
  --kc-border:#d9d5cb;
  --kc-field:#ffffff;
  --kc-ring:rgba(22,38,61,.16);
  --kc-grey:#6a6e74;
}

input,select,textarea,button{--keel-control:1}

/* ---- Tick boxes and radio buttons ---- */
input[type=checkbox],input[type=radio]{
  -webkit-appearance:none !important;appearance:none !important;
  width:18px !important;height:18px !important;min-width:18px !important;max-width:18px !important;min-height:18px !important;
  flex:0 0 18px;box-sizing:border-box !important;padding:0 !important;
  border:1.5px solid var(--kc-border) !important;background:var(--kc-field) center/11px 11px no-repeat !important;
  cursor:pointer;vertical-align:-3px;
  transition:background-color .12s ease,border-color .12s ease;
}
input[type=checkbox]{border-radius:4px !important}
input[type=radio]{border-radius:50% !important}
input[type=checkbox]:checked{
  background-color:var(--kc-ink) !important;border-color:var(--kc-ink) !important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.4 6.3l2.4 2.4 4.8-5.2'/%3E%3C/svg%3E") !important;
}
input[type=checkbox]:indeterminate{
  background-color:var(--kc-ink) !important;border-color:var(--kc-ink) !important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6h6' stroke='%23fff' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") !important;
}
input[type=radio]:checked{
  border-color:var(--kc-ink) !important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='4' fill='%2316263d'/%3E%3C/svg%3E") !important;
}
input[type=checkbox]:disabled,input[type=radio]:disabled{opacity:.45;cursor:default}
/* The label round a tick box or radio is what a thumb taps, and that tap area is at least 44 pixels high. It is drawn
   as an invisible band behind the row, so the row itself keeps its height and nothing on the page moves; a link inside
   the label stays on top of it. */
label:has(> input[type=checkbox]),label:has(> input[type=radio]){position:relative;cursor:pointer;-webkit-tap-highlight-color:transparent}
label:has(> input[type=checkbox])::after,label:has(> input[type=radio])::after{content:'';position:absolute;left:0;right:0;top:50%;height:max(44px,100%);transform:translateY(-50%);z-index:1}
label:has(> input[type=checkbox]) a,label:has(> input[type=radio]) a{position:relative;z-index:2}
/* The box itself is above the band too, so a tap on the box is a tap on the box (a restaurant's Select all on Capture
   could not be ticked under it, 24 Nov 2026). :where() keeps this the weakest rule, so a page that places its own box
   (a picker kept 1 pixel wide, i.html) still places it. */
:where(label:has(> input[type=checkbox]),label:has(> input[type=radio])) > :where(input[type=checkbox],input[type=radio]){position:relative;z-index:2}

/* ---- Dropdowns: a thin chevron instead of the system arrow ---- */
select:not([multiple]):not([size]){
  -webkit-appearance:none;appearance:none;cursor:pointer;text-overflow:ellipsis;padding-right:34px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236a6e74' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 13px center;background-size:12px 8px;
}
select{color-scheme:light;accent-color:var(--kc-ink)}

/* ---- Date and time boxes: the box is Keel's; the phone's own calendar takes navy for its highlights ---- */
input[type=date],input[type=time],input[type=datetime-local],input[type=month],input[type=week]{
  -webkit-appearance:none;appearance:none;accent-color:var(--kc-ink);color-scheme:light;min-height:44px;text-align:left;
}
input::-webkit-calendar-picker-indicator{opacity:.5;cursor:pointer;border-radius:4px}
input::-webkit-calendar-picker-indicator:hover{opacity:.9}

/* ---- Number boxes: no spinner arrows ---- */
input[type=number]{-moz-appearance:textfield;appearance:textfield}
input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
input[type=search]::-webkit-search-decoration{-webkit-appearance:none}

/* ---- File pickers: Keel's quiet button instead of "Choose file" in grey ---- */
input[type=file]{font:inherit;font-size:14px;color:var(--kc-grey);max-width:100%}
input[type=file]::file-selector-button,input[type=file]::-webkit-file-upload-button{
  -webkit-appearance:none;appearance:none;font:500 14px/20px Inter,system-ui,sans-serif;color:var(--kc-ink);
  background:var(--kc-field);border:1px solid var(--kc-border);border-radius:10px;padding:11px 16px;min-height:44px;margin:0 12px 0 0;cursor:pointer;
}

/* ---- Sliders ---- */
input[type=range]{accent-color:var(--kc-ink);min-height:44px;cursor:pointer}

/* ---- Text boxes: no corner drag handle; the box grows with the words where a screen asks it to ---- */
textarea{resize:none !important}

/* ---- Focus: a navy ring for the keyboard, never the browser's blue; a text field shows its own border ---- */
:focus{outline:none}
:focus-visible{outline:2px solid var(--kc-ink) !important;outline-offset:2px !important}
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):focus-visible,select:focus-visible,textarea:focus-visible{
  outline:none !important;border-color:var(--kc-ink) !important;box-shadow:0 0 0 3px var(--kc-ring) !important;
}
input[type=checkbox]:focus-visible,input[type=radio]:focus-visible{outline:2px solid var(--kc-ink) !important;outline-offset:2px !important}

/* ---- Autofill: the field keeps its own colours, not Safari's yellow or Chrome's blue ---- */
input:-webkit-autofill,input:-webkit-autofill:hover,input:-webkit-autofill:focus,textarea:-webkit-autofill,select:-webkit-autofill{
  -webkit-text-fill-color:var(--kc-ink) !important;caret-color:var(--kc-ink);
  -webkit-box-shadow:0 0 0 1000px var(--kc-field) inset !important;box-shadow:0 0 0 1000px var(--kc-field) inset !important;
  transition:background-color 9999s ease 0s;
}
input:autofill{background-color:var(--kc-field) !important}

/* ---- Selected words ---- */
::selection{background:rgba(22,38,61,.16);color:inherit}

/* ---- Scrollbars, where a computer shows them: thin and Keel's grey, never the system's thick bar. Only the standard
   settings: styling ::-webkit-scrollbar would put a bar on every scrolling row on a Mac, where today none shows. ---- */
html{scrollbar-color:rgba(22,38,61,.28) transparent}
*{scrollbar-width:thin}
