/* ===========================================================================
   Interaction layer
   ---------------------------------------------------------------------------
   The states the components above were drawn without: where the keyboard is,
   that a press landed, which field the cursor is over, which layer is on top.
   None of it changes a layout or a colour decision made earlier in this file;
   every rule here is a state on top of one. It sits last so it wins on source
   order alone, without raising any selector's specificity.

   Benchmarked against the outreach tools people already work in all day —
   Unify, Wrangle, Lemni, Apollo, folk, Notion Mail — where the shared idiom
   is quiet chrome that answers every hover, press and focus.
   =========================================================================== */

:root {
  /* One curve for everything that responds to a hand. `ease` starts slowly,
     which on a 140ms press reads as lag; this is fast out of the gate and
     settles. */
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  /* The focus ring, as a halo rather than an outline: it follows the pill
     radius, it does not shift layout, and it reads on the ink sidebar as well
     as on white. Brand-derived, so a customer's accent carries it. */
  --ring: 0 0 0 3px color-mix(in srgb, var(--teal) 38%, transparent);

  /* Elevation: two layers above the page, each with its one shadow, so how
     high a thing sits reads the same everywhere (rule in frontend/CLAUDE.md,
     "Two shadow layers"). Containers resting on the page are not a layer:
     they keep the faint 0 1px 2px edge. Tinted with Candid's ink rather than
     black, so a shadow on the grey page does not read as dirt.
     - low: a little above the content: a card under the cursor, a floating
       composer or save bar, the board's arrows, the cards in a drawer's art.
       -up is the same layer pinned to a bottom edge, casting upward.
     - top: above everything: modals, drawers, menus and popovers, tooltips,
       toasts, the call bar, and the calendar's time-now pill. */
  --shadow-low: 0 1px 2px rgba(16, 33, 31, .06), 0 6px 16px -8px rgba(16, 33, 31, .24);
  --shadow-low-up: 0 1px 2px rgba(16, 33, 31, .04), 0 -6px 16px -8px rgba(16, 33, 31, .18);
  --shadow-top:
    0 0 0 1px rgba(16, 33, 31, .06),
    0 4px 12px -2px rgba(16, 33, 31, .10),
    0 22px 50px -12px rgba(16, 33, 31, .30);
  /* The old name for the low layer, kept so nothing still using it breaks. */
  --lift: var(--shadow-low);

  /* Buttons are flat, like the rest of the app: a solid fill, or white with
     an ink-tinted hairline, never a gradient or a shadow. The edge is tinted
     with the ink rather than a neutral grey, so a white button sits in the
     palette instead of looking like a wireframe; hover deepens the edge and
     washes the fill grey. */
  --btn-edge: color-mix(in srgb, var(--ink-fixed) 17%, transparent);
  --btn-edge-hover: color-mix(in srgb, var(--ink-fixed) 30%, transparent);
  --btn-wash: color-mix(in srgb, var(--text) 4%, var(--card));
}

/* --- focus --------------------------------------------------------------
   Only .linkbtn and .check had a visible keyboard focus. Every pill control,
   the nav, the tabs and the switches fell back to the browser's outline,
   which Chrome draws as a square around a round button. */
.btn:focus-visible, .iconbtn:focus-visible, .filterbtn:focus-visible,
.chip:focus-visible, .tab:focus-visible, .gearbtn:focus-visible,
.switch:focus-visible, .navitem:focus-visible, .aside__toggle:focus-visible,
.userrow:focus-visible, .usermenu__item:focus-visible, .closer:focus-visible,
.panel__link:focus-visible, .seqcard:focus-visible, .cconnect__step:focus-visible,
.corow:focus-visible, .tabbar__item:focus-visible, table.tbl tbody tr:focus-visible {
  outline: none; box-shadow: var(--ring);
}
.closer:focus-visible, .aside__toggle:focus-visible { border-radius: var(--r-pill) }

/* --- press --------------------------------------------------------------
   A press that shows nothing until the network answers feels like a missed
   click. A 3% squeeze on :active is the acknowledgement; the result still
   arrives when it arrives. */
.btn, .iconbtn, .filterbtn, .chip, .tab, .gearbtn {
  transition:
    opacity .16s ease, border-color .16s ease, background-color .16s ease,
    color .16s ease, box-shadow .16s ease, transform .14s var(--ease-out);
}
.btn:active:not(:disabled), .iconbtn:active:not(:disabled), .filterbtn:active,
.chip:active, .tab:active, .gearbtn:active, .usermenu__item:active {
  transform: scale(.97);
}
.navitem { transition: background .18s ease, color .18s ease, gap .22s ease, padding .22s ease, transform .14s var(--ease-out) }
.navitem:active { transform: scale(.98) }

/* --- hover --------------------------------------------------------------
   The solid button answered hover by going 12% see-through, which on the grey
   page turns ink to slate and muddies a coloured brand. Mixing toward its own
   foreground lifts a dark brand and deepens a pale one, and the label keeps
   full contrast throughout. The coloured variants keep their own hovers. */
.btn:not(.btn--ghost):not(.btn--go):not(.btn--bad):not(.btn--accent):not(.btn--teal):not(.btn--danger):hover:not(:disabled) {
  opacity: 1; background-color: color-mix(in srgb, var(--ink) 88%, var(--on-ink));
}
.btn--teal:hover:not(:disabled), .btn--accent:hover:not(:disabled) {
  opacity: 1; background-color: color-mix(in srgb, var(--teal) 86%, var(--on-teal));
}
/* A white key answers in grey, not in the accent: a teal tint on hover made
   Cancel look selected. */
.btn--ghost:hover:not(:disabled), .iconbtn:hover:not(:disabled) {
  background-color: var(--btn-wash); border-color: var(--btn-edge-hover);
}

/* A chip had no hover at all, so in a row of them the only one that moved
   under the cursor was the one already selected. */
.chip:not([aria-pressed="true"]):hover { border-color: var(--btn-edge-hover); background-color: var(--btn-wash); color: var(--text) }

/* The buttons that grew up outside .btn take the same edge and hover, so a
   meeting slot or a setup choice is the same button as everywhere else. */
.slot, .setupchip, .searchbtn, .today__go {
  border-color: var(--btn-edge);
}
.slot:not([aria-pressed="true"]):hover, .setupchip:not([aria-pressed="true"]):hover,
.searchbtn:hover, .today__go:hover {
  border-color: var(--btn-edge-hover); background-color: var(--btn-wash);
}

/* --- fields -------------------------------------------------------------
   Soft fill (css/forms.css): the grey well darkens a step under the cursor,
   and the field being typed in turns white with a 1.5px deep-teal edge, so it
   is unmissable down a long form without moving anything. No glow around it
   (Rob, 11 Nov 2026): the edge is the focus.
   An open dropdown wears the same focus as a field being typed in. */
.input, .textarea, .select { transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease }
.input:hover:not(:focus):not(:disabled),
.textarea:hover:not(:focus):not(:disabled),
.select:hover:not(:focus):not(:disabled):not([aria-expanded="true"]) {
  background-color: var(--field-hover); border-color: var(--field-edge-hover);
}
:is(.input, .textarea, .select):is(:focus, [aria-expanded="true"]) {
  background-color: var(--card); border-color: var(--field-focus);
  box-shadow: inset 0 0 0 .5px var(--field-focus);
}
:is(.input, .textarea, .select)[aria-invalid="true"]:is(:focus, :hover) {
  background-color: var(--card); border-color: var(--bad);
  box-shadow: inset 0 0 0 .5px var(--bad);
}
@media (prefers-reduced-motion: reduce) { .input, .textarea, .select { transition: none } }
/* Fields drawn as a box around a bare input (the header search, the drawer
   finders) wear the same focus as .input. */
.search, .notesbar__search, .ctfind__search { transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease }
.search:focus-within { background: var(--card); border-color: var(--field-focus); box-shadow: inset 0 0 0 .5px var(--field-focus) }
:is(.notesbar__search, .ctfind__search):focus-within { box-shadow: 0 0 0 1.5px var(--field-focus) }

/* The browser's placeholder grey sits under 3:1, below the floor for the
   hint that says what a field wants. --field-ph clears 5:1 on the grey well;
   #767676 is the lightest grey that clears 4.5:1 on the white search. */
.input::placeholder, .textarea::placeholder { color: var(--field-ph); opacity: 1 }
.search input::placeholder, .notesbar__field::placeholder, .ctfind__field::placeholder { color: var(--field-ph); opacity: 1 }

/* Disabled and read-only lose the well, so neither reads as an empty field
   waiting to be filled: a dashed edge for one that can't be changed now, a
   plain hairline for one that only shows a value. */
.input:disabled, .textarea:disabled, .select:disabled {
  background: none; border: 1px dashed rgba(16, 33, 31, .25); color: var(--muted); cursor: not-allowed; box-shadow: none;
}
.input[readonly] { background: none; border-color: var(--field-edge); color: var(--muted) }

/* --- figures ------------------------------------------------------------
   Proportional digits make a column of numbers ragged, and make a figure
   that counts up shuffle sideways as each digit changes width. Geist ships
   tabular figures; everywhere a number is read against another uses them. */
.kpi__value, .heroflow__n, .stat__value,
.barrow__value, .barrow__meta, .prio__head span, .navitem__badge, .navitem__alert,
table.tbl td, .tile__value {
  font-variant-numeric: tabular-nums;
}

/* --- surfaces -----------------------------------------------------------
   Clickable cards lift a pixel and pick up a shadow under the cursor, so the
   ones that open something are told apart from the ones that only show
   something. A border colour change did that on white but not on the grey
   page these cards sit on. */
.seqcard { transition: border-color .16s ease, box-shadow .2s ease, transform .2s var(--ease-out) }
.seqcard:hover { box-shadow: var(--shadow-low); transform: translateY(-1px) }

/* The table row hover was a fill alone. A bar on the leading edge points at
   the row the click will open, the way an inbox does. An inset shadow on the
   first cell, so no column moves. */
table.tbl tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--teal) }

/* Overlays. The scrim softens what is behind it, so the drawer or the dialog
   reads as the thing in front rather than as more page. */
.scrim { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px) }
@media (prefers-reduced-transparency: reduce) {
  .scrim { backdrop-filter: none; -webkit-backdrop-filter: none }
}
.drawer { box-shadow: var(--shadow-top) }
.toast { box-shadow: var(--shadow-top) }

/* The empty state's icon was a pale grey glyph floating over the heading,
   the same grey as a disabled control. Set in a tinted tile it reads as a
   deliberate mark, as it does in every inbox and CRM it sits beside, and it
   carries the brand accent. */
/* Direct children only: an icon inside the empty state's button is the
   button's, and took the tile over its own label. */
.empty > .ms, .threadempty > .ms {
  width: 64px; height: 64px; margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: 20px; font-size: 30px;
  background: color-mix(in srgb, var(--teal) 12%, var(--card));
  color: color-mix(in srgb, var(--teal) 55%, var(--ink));
}
.threadempty > .ms { width: 52px; height: 52px; border-radius: 16px; font-size: 24px; margin-bottom: 6px }

/* Switch: the track darkens on hover so it reads as something to press
   rather than a status lamp, and the knob stretches toward where it is going
   while held — the iOS cue that the press has been felt. */
.switch:hover { background: color-mix(in srgb, var(--ink) 18%, var(--line)) }
.switch[aria-checked="true"]:hover { background: color-mix(in srgb, var(--teal) 88%, var(--ink)) }
.switch__knob { transition: transform .18s cubic-bezier(.32, .72, 0, 1), width .14s var(--ease-out) }
.switch:active .switch__knob { width: 22px }
.switch[aria-checked="true"]:active .switch__knob { transform: translateX(14px) }

/* --- measure ------------------------------------------------------------
   Data screens fill the width beside the nav, as Quo, Snowflake and Unify lay
   theirs out. They used to stop at 1680px, which on a 27-inch monitor left a
   band of grey down each side; the display scale now draws that monitor at
   120%, which is what kept a dashboard panel from running 2,200px wide.
   Only a screen more than three times as wide as it is tall (a 49-inch 32:9,
   marked data-ultrawide by shared/display-scale.js) stops them, at 2600px,
   centred. The voice page keeps a reading column at every size: uncapped, a
   form put four inputs in a row with a thousand pixels between a label and
   the value it named. Your profile and Settings fill the width too, by
   laying their containers out in columns rather than by widening them
   (.mepage in profile-settings.css, .setcols in settings.css). */
.main > .screen, .main > .settingspage { width: 100%; margin-inline: auto }
[data-ultrawide] .main > .screen, [data-ultrawide] .main > .settingspage { max-width: 2600px }
.main > .screen:has(> .formpage:not(.mepage)) { max-width: 1120px }

/* --- reduced motion -----------------------------------------------------
   The rule near the top stops keyframe animations. It left every transition
   and the press squeeze running, which is most of the motion in the app. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important }
  .btn:active, .iconbtn:active, .filterbtn:active, .chip:active, .tab:active,
  .gearbtn:active, .usermenu__item:active, .navitem:active,
  .seqcard:hover { transform: none !important }
}

.panel__link--icon {
  width: 34px; height: 34px; border-radius: var(--r-pill); display: grid; place-items: center;
  border: 1px solid var(--btn-edge); background: var(--card);
}
.panel__link--icon:hover { border-color: var(--btn-edge-hover); background-color: var(--btn-wash) }
.panel__link--icon .ms { font-size: 18px }
