/* ============================================================
   access.css — accessibility (WCAG 2.2 AA), build 4, v1.82.0 (2026-10-26)
   Loaded last, so on a tie it wins. Everything here exists for one of these:
   focus you can see (2.4.7, 1.4.11), words you can read (1.4.3), targets you
   can hit (2.5.8), motion that can be calmed (2.3.3, 2.2.2), and zoom that
   doesn't break the page (1.4.4, 1.4.10, 1.4.12). The audit that drove it:
   product/docs/accessibility-audit-2026-10-26.md.
   ============================================================ */

/* ---------- tokens ---------- */
:root { --focus: #16202E; --focus-halo: #FFFFFF; }
:root[data-theme="dark"] { --focus: #FFFFFF; --focus-halo: #0C0F14; }
/* on a dark or coloured surface the ring is drawn the other way round: white line, dark halo */
.sidebar, .statbar__b.is-on:focus-visible, .avail__b.is-on:focus-visible, .cal2__d.is-sel:focus-visible, .segs__b.is-on:focus-visible,
.segpick__o input:checked:focus-visible + span, .segpick__b.is-on:focus-visible { --focus: #FFFFFF; --focus-halo: #16202E; }

/* ---------- focus: one two-tone ring everywhere (dark ring + light halo, so it shows on any colour) ---------- */
/* :where() keeps this rule's specificity low, so the inset and stretched-button rules below can win */
:focus-visible:where(:not(.segpick__o input):not(.swatch input):not(.acct__swatch input):not(.con__seg input)) {
  outline: 2px solid var(--focus) !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--focus-halo) !important;
}
/* a focused thing at the edge of a scrolling area scrolls in with room for its ring */
#view, .panel__body, .sidebar__scroll, .modal__body, .ddlist { scroll-padding: 12px; }
/* things packed in a list or a bar: the ring sits inside, so it never covers a neighbour */
.ctx__i:focus-visible, .ctx__sb:focus-visible, .ddlist__o:focus-visible, .tab:focus-visible, .navitem:focus-visible,
.cal2__d:focus-visible, .cal2__quick:focus-visible, .segpick__b:focus-visible, .statbar__b:focus-visible, .avail__b:focus-visible,
.cal__ev:focus-visible, .cal__more:focus-visible, .segs__b:focus-visible, .filter:focus-within, .shift__open:focus-visible {
  outline-offset: -2px;
  box-shadow: inset 0 0 0 4px var(--focus-halo) !important;
}
.segpick__o input:focus-visible + span, .swatch input:focus-visible + span, .acct__swatch input:focus-visible + span, .con__seg input:focus-visible + span {
  outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus-halo);
}
/* a card's name is the button; the whole card shows the ring */
.card:has(.card__open:focus-visible), .erow:has(.erow__open:focus-visible), .shift:has(> .shift__open:focus-visible) {
  outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus-halo), var(--lk-shadow, none);
}
.card .card__open:focus-visible, .erow .erow__open:focus-visible, .shift .shift__open:focus-visible { outline: none !important; box-shadow: none !important; }
/* landing spots focus() moves to are not controls: no ring */
#main:focus, #panel:focus, .modal:focus { outline: none !important; box-shadow: none !important; }
@media (forced-colors: active) { :focus-visible { outline-color: Highlight !important; } }

/* ---------- skip link (2.4.1): the first thing the keyboard reaches in the app ---------- */
.skip-link { position: absolute; left: 12px; top: 12px; z-index: 1000; padding: 12px 16px; border-radius: 8px;
  background: #16202E; color: #fff; font-weight: 600; text-decoration: none; transform: translateY(-200%); }
.skip-link:focus { transform: none; }

/* ---------- the card: the event's name is a button stretched over the card; the Available / Maybe / Can't
   buttons sit above it, so they are still their own targets (app.js eventCard) ---------- */
.card, .erow, .shift { position: relative; }
.card__open, .erow__open, .shift__open { all: unset; cursor: pointer; display: inline; font: inherit; color: inherit; }
.card__open::after, .erow__open::after, .shift__open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card .avail, .card .card__avail, .erow .erow__end, .shift > .avail, .shift > .chip, .shift > .iconbtn { position: relative; z-index: 1; }

.def__edit { margin-left: 6px; vertical-align: middle; }
/* the eye (v1.83): sits inside the password box, 36 px, on every password box in the app */
.field__wrap { position: relative; display: flex; align-items: center; width: 100%; }
.field__wrap > input, .field__wrap > .input { flex: 1 1 auto; width: 100%; min-width: 0; padding-right: 48px; }
.field__eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 36px; height: 36px;
  padding: 0; border: 0; border-radius: 8px; background: none; color: var(--txt-2); cursor: pointer; }
.field__eye svg { width: 22px; height: 22px; }
.field__eye:hover, .field__eye.is-on { color: var(--txt-1); background: var(--bg-4); }
.gate.phesti .field__eye { color: var(--p-ink, #EFECE7); }
.gate.phesti .field__eye:hover, .gate.phesti .field__eye.is-on { color: #fff; background: rgb(239 236 231 / .16); }
.con .field__eye { color: var(--c-ink, #EFECE7); }
.con .field__eye:hover, .con .field__eye.is-on { background: rgb(239 236 231 / .16); }
/* ---------- words you can read (1.4.3): the greys and washes that sat just under 4.5:1 ---------- */
.sidebar__wordmark span, #brand-sub { color: rgb(255 255 255 / .92); }
.navitem__count, .navitem.is-active .navitem__count { color: #fff; }
.filter__n, .filter:has(input:checked) .filter__n { color: rgb(255 255 255 / .94); }
.sidebar__whoname span { color: rgb(255 255 255 / .92); }
.navitem.is-active { background: rgb(0 0 0 / .2); }
:root[data-theme="dark"] .navitem.is-active { background: rgb(255 255 255 / .14); }
.card .card__mon, .card .card__dow, .card.is-today .card__mon, .card.is-today .card__dow,
.card__kicker, .card__kind, .card .card__pend,
.card__facts, .fact .ico, .fact--time .ico, .card .notech, .card .mini__l { color: var(--on-bk); }
/* the date block: a light wash lowered white words under 4.5:1 on some category colours; a dark wash raises them.
   Light category colours (dark words) keep a light wash. Past cards set their own below. */
.card .card__date, .card.is-today .card__date, .cards .card .card__date, .cards .card.is-today .card__date { background: rgb(0 0 0 / .16); }
.card[style*="--bk-on"] .card__date, .card.is-today[style*="--bk-on"] .card__date,
.cards .card[style*="--bk-on"] .card__date, .cards .card.is-today[style*="--bk-on"] .card__date { background: rgb(255 255 255 / .4); }
.erow .erow__date, .erow.is-today .erow__date { background: rgb(0 0 0 / .16); }
.erow[style*="--bk-on"] .erow__date { background: rgb(255 255 255 / .4); }
.fact--setup.is-unset { opacity: 1; font-weight: 400; }
.card .mini--empty .mini__n { opacity: 1; font-weight: 500; }
.erow .erow__w { color: var(--on-bk); }
.card.is-cancelled .card__name, .card.is-cancelled .card__name span, .erow.is-cancelled .erow__n { color: #fff; }
.section__h .btn--sm { opacity: 1; color: var(--txt-2); }
.cal__cell.is-out .cal__n { opacity: 1; color: var(--txt-3); }
.cal2__d.is-out { opacity: 1; color: var(--txt-3); }
.av--ghost { color: var(--txt-2); }
.erow .binrow__when { color: var(--on-bk); }
/* dark mode: the three deep-brand accents that vanished on a dark surface */
:root[data-theme="dark"] .def--static dd, :root[data-theme="dark"] .shift__hours, :root[data-theme="dark"] .chip--brand { color: var(--brand-300); }
:root[data-theme="dark"] .chip--brand { border-color: var(--brand-800, var(--line-2)); }
/* the status bar's pressed choice wears the fixed status colours (the pale dark-mode green left white words at 1.9:1) */
.statbar__b--ok.is-on { background: var(--st-ok); } .statbar__b--warn.is-on { background: var(--st-pend); } .statbar__b--bad.is-on { background: var(--st-canc); }
/* pending: the stripes darken the colour instead of lightening it, so the white words keep their contrast */
.card.is-pending, .card.is-pending:hover, .cards .card.is-pending:hover, .erow.is-pending, .erow.is-pending:hover {
  background-image: repeating-linear-gradient(135deg, rgb(0 0 0 / .12) 0 12px, transparent 12px 24px); }

/* past events (the owner, 2026-10-26, v1.83: a tint "looked like another live colour"): a past card goes GREY, with grey words
   that still read at 4.5:1 (the old 50% fade left every word under 3:1). Its category keeps a dot, a tinted date block
   and the crew colours; the tick on the date and the green Done bar stay. Cancelled past: grey too, with the red tag. */
.card.is-past:not(.is-cancelled), .card.is-past:not(.is-cancelled):hover,
.card.is-past.is-cancelled, .card.is-past.is-cancelled:hover {
  opacity: 1; --on-bk: var(--txt-2); background-color: var(--bg-3); background-image: none; }
.card.is-past .card__name, .card.is-past .card__day, .card.is-past .card__mon, .card.is-past .card__dow, .card.is-past.is-today .card__mon, .card.is-past.is-today .card__dow { color: var(--txt-1); }
.card.is-past.is-cancelled .card__name, .card.is-past.is-cancelled .card__name span { color: var(--txt-2); text-decoration-color: var(--txt-2); }
.card.is-past .card__kind::before, .card.is-past .mini__fill, .card.is-past .mini__fill.is-done { background: var(--bk-solid); }
.card.is-past .card__date, .card.is-past.is-today .card__date, .cards .card.is-past .card__date, .cards .card.is-past.is-today .card__date,
.cards .card.is-past[style*="--bk-on"] .card__date { background: color-mix(in srgb, var(--bk-solid) 20%, var(--bg-3)); }
.card.is-past .crewstack .av, .cards .card.is-past .crewstack .av, .cards .card.is-past:hover .crewstack .av { border-color: var(--bg-3); }
.erow.is-past:not(.is-cancelled), .erow.is-past.is-cancelled, .erow.is-past:hover {
  opacity: 1; --on-bk: var(--txt-2); background-color: var(--bg-3); background-image: none; filter: none; }
.erow.is-past .erow__n, .erow.is-past .erow__day, .erow.is-past .erow__mon, .erow.is-past.is-today .erow__mon { color: var(--txt-1); }
.erow.is-past.is-cancelled .erow__n { color: var(--txt-2); text-decoration-color: var(--txt-2); }
.erow.is-past .erow__date { background: color-mix(in srgb, var(--bk-solid) 20%, var(--bg-3)); }
.cal__ev.is-past, .cal__ev.is-past.is-cancelled { opacity: 1; color: var(--txt-2); }
.cal__ev.is-cancelled { opacity: 1; }
.cal .cal__ev.is-past[style]:not(.is-cancelled) { background: var(--bg-3); border-left-color: var(--bk); }

/* ---------- targets (2.5.8 floor 24px; house 44px on a finger) ---------- */
.iconbtn, .monthnav__btn, .panel__close, .segs__b, .cal2__nav, .calnav__btn, .sidebar__toggle { position: relative; }   /* .datefield__btn is already absolute (styles.css): relative here pushed the calendar icon over the date box */
.iconbtn::after, .monthnav__btn::after, .panel__close::after, .segs__b::after, .cal2__nav::after, .calnav__btn::after, .datefield__btn::after {
  content: ""; position: absolute; inset: -7px; }
.sidebar__foldbtn { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; flex: 1; min-height: 28px; font: inherit; color: inherit; border-radius: 6px; }
.sidebar__foldbtn .ico { width: 15px; height: 15px; margin-left: auto; color: rgb(255 255 255 / .8); transition: transform .18s var(--lk-ease, ease); }
.sidebar__block.is-folded .sidebar__foldbtn .ico { transform: rotate(-90deg); }
@media (pointer: coarse) {
  .navitem, .tab, .btn:not(.btn--sm), .ddpick__b, .filter, .catbar, .statbar__b { min-height: 44px; }
  .cal2__d { height: 40px; }
}

/* ---------- iOS: a box under 16px makes Safari zoom the page on focus ---------- */
@media (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]), select, textarea, .input, .textarea, .quickadd__in, .topbar__input { font-size: max(16px, 1em); }
}

/* ---------- zoom and text spacing (1.4.4, 1.4.10, 1.4.12): names wrap instead of being cut off ---------- */
.card__name span, .erow__n, .cal__ev span { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.erow__n { min-width: 0; }

/* ---------- motion (2.3.3, 2.2.2): with Reduce Motion on, nothing travels; loading spinners keep turning ---------- */
@media (prefers-reduced-motion: reduce) {
  :root :not([data-motion-safe]), :root :not([data-motion-safe])::before, :root :not([data-motion-safe])::after {
    animation-duration: 1ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
  }
}

/* v1.99.0 (WCAG 1.4.11, 3:1 for the edge of a control): the outline of text boxes, drop-downs and the search box
   was --line-2 (1.6:1 on white). --edge is 3.2:1 or more on every light background (#7C8594) and 3.35:1 or more on
   every dark one, whatever the client's brand colour (#6F7886). Hover and focus colours are unchanged. */
:root { --edge: #7C8594; }
:root[data-theme="dark"] { --edge: #6F7886; }
.input, .select, .textarea, .topbar__input, select, textarea { --line: var(--edge); --line-2: var(--edge); }
/* the sidebar's unticked filter boxes: the ring was 30% white (1.9:1); now as strong as a ticked box's */
.sidebar .filter input:not(:checked) { box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / .75); }
.sidebar .filter:hover input:not(:checked) { box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / .95); }
