/* omni-actions.css -- the site's ONE action system.
 * ============================================================================
 * Every button, action link, segmented tab and disclosure on omnistrat.ai is
 * drawn by this file and by nothing else. Each page links it BEFORE its own
 * <style>, and no page or script re-declares .btn, .btn-primary,
 * .btn-secondary or .link-action (_test/actions-system.mjs fails the build if
 * one does). Pages keep their LAYOUT rules (where a control sits, how wide it
 * is); the look lives here.
 *
 * WHY. Until 2026-10-19 every page re-declared its own buttons inside its own
 * <style>: ~250 uses, eight slightly different pills, 180 border-radius:999px
 * and an arrow on nearly every label. The owner's verdict on the live site was
 * that the buttons "spammed across the entire website" and read as machine
 * built. Two causes: when every control is the loudest control the page has no
 * loudest control, and an arrow on every label stops meaning "forward" and
 * becomes texture. One file makes a single decision instead of sixty.
 *
 * THREE TIERS, NOTHING ELSE
 *   .btn.btn-primary    the ONE action a section exists for. At most one per
 *                       section; a card in a grid gets none (see .action-card).
 *   .btn.btn-secondary  a real alternative action.
 *   .link-action        navigation / read more. Text, underlined, no glyph.
 *   .btn-sm and .btn-danger are a SIZE and a TONE of those tiers, not tiers.
 *
 * TOKENS. Pages own their palette (the stone neutrals in each :root, and the
 * light / dark / high-contrast blocks), and this file adds NOTHING to it: no
 * colour, font, shadow, gradient or radius of its own (owner, 2026-10-19:
 * "always ensure the persistent aesthetic I have built"). Not every page
 * defines every token, so a missing one is DERIVED from --ink and --bg (which
 * every page defines and flips with the theme); radii are --radius-sm, or a
 * nested radius computed from it.
 *
 * MOTION. Colour transitions only (120ms). No lift, no slide, no arrow nudge.
 * Off under prefers-reduced-motion and under the site's [data-motion=reduced].
 * ========================================================================= */

.btn, .link-action, .segmented, .seg-tab, .action-card, .disclosure, .disclosure-wrap {
  --oa-ink: var(--ink);
  --oa-bg: var(--bg);
  --oa-surface: var(--surface, var(--oa-bg));
  --oa-soft: var(--surface-soft, color-mix(in oklab, var(--oa-ink) 6%, var(--oa-bg)));
  --oa-border: var(--border, color-mix(in oklab, var(--oa-ink) 12%, var(--oa-bg)));
  --oa-border-mid: var(--border-mid, color-mix(in oklab, var(--oa-ink) 20%, var(--oa-bg)));
  --oa-border-strong: var(--border-strong, color-mix(in oklab, var(--oa-ink) 42%, var(--oa-bg)));
  --oa-ease: var(--ease, cubic-bezier(0.16, 1, 0.3, 1));
  --oa-font: var(--font, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif);
}

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  -webkit-appearance: none; appearance: none;
  box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; margin: 0;
  border: 0; border-radius: var(--radius-sm, 8px);
  /* A bare .btn renders as the secondary tier: an unclassed button must never
     be the loudest thing on the page by accident. */
  background: var(--oa-soft); color: var(--oa-ink);
  font: 500 14px/1.2 var(--oa-font); letter-spacing: -0.005em;
  text-align: center; text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background-color 120ms var(--oa-ease), box-shadow 120ms var(--oa-ease), color 120ms var(--oa-ease);
}
.btn:focus-visible { outline: 2px solid var(--oa-ink); outline-offset: 2px; }
/* An author display beats the UA's [hidden] rule; without this every hidden
   button on the site (Claim a seat, Give up my seat, ...) would appear. */
.btn[hidden], .link-action[hidden], .seg-tab[hidden], .disclosure-actions[hidden] { display: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--oa-ink); color: var(--oa-bg); }
.btn-primary:hover:not(:disabled) { background: color-mix(in oklab, var(--oa-ink) 86%, var(--oa-bg)); color: var(--oa-bg); }
.btn-primary:active:not(:disabled) { background: color-mix(in oklab, var(--oa-ink) 78%, var(--oa-bg)); }

.btn-secondary { background: var(--oa-soft); color: var(--oa-ink); }
.btn-secondary:hover:not(:disabled) { box-shadow: inset 0 0 0 1px var(--oa-border-mid); color: var(--oa-ink); }
.btn-secondary:active:not(:disabled) { box-shadow: inset 0 0 0 1px var(--oa-border-strong); }

/* On an inverted panel (a dark CTA band on the light theme, and the reverse):
   the tiers swap ink and paper so the primary is still the strongest thing in
   the panel. Put .on-ink on the PANEL; never restyle the button locally. */
.on-ink .btn, .on-ink .link-action {
  --oa-ink: var(--bg);
  --oa-bg: var(--ink);
  --oa-soft: color-mix(in oklab, var(--bg) 14%, var(--ink));
  --oa-border-mid: color-mix(in oklab, var(--bg) 32%, var(--ink));
  --oa-border-strong: color-mix(in oklab, var(--bg) 50%, var(--ink));
}

/* Size and tone modifiers. Not tiers: a small primary is still THE action. */
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
/* The loss token alone is 4.43:1 on the soft fill at 13-14 px (persona audit
   24, A24-23; 4.5:1 is needed). Drawn a fifth of the way toward the ink it
   reads as the same red and passes in both themes: darker on paper, lighter
   on the dark palette, because --oa-ink flips with the theme. */
.btn-danger { color: color-mix(in oklab, var(--loss, var(--oa-ink)) 78%, var(--oa-ink)); }
.btn-danger:hover:not(:disabled) { color: color-mix(in oklab, var(--loss, var(--oa-ink)) 78%, var(--oa-ink)); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--loss, var(--oa-ink)) 45%, var(--oa-soft)); }

/* A BUTTON THAT IS A LINK KEEPS ITS TIER'S COLOURS. Pages colour the links
   inside their notes and panels ("#cfgNote a { color: inherit }", ".fine a",
   ".note a"), and a descendant link rule with an id or two classes outranks
   ".btn-primary" (one class): Foundry's "Sign it" -- the one action that makes
   a saved build verifiable -- rendered the note's grey on the primary's ink,
   1.7:1 light and 1.4:1 dark (persona audit 24, A24-02). The :not() below
   names an id no element has; it adds an id's weight to the selector without
   narrowing it, so the tier's colour beats any page's "<container> a" rule
   and the look stays decided here, once, as this file promises. Only colour
   is raised; layout stays the page's. */
a.btn:not(#oa-tier-colour) { color: var(--oa-ink); }
a.btn.btn-primary:not(#oa-tier-colour),
a.btn.btn-primary:not(#oa-tier-colour):hover { color: var(--oa-bg); }
a.btn.btn-danger:not(#oa-tier-colour) { color: color-mix(in oklab, var(--loss, var(--oa-ink)) 78%, var(--oa-ink)); }

/* Touch targets reach 44px on phones (WCAG 2.5.5). */
@media (max-width: 720px) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
}

/* High contrast: a soft fill alone is not a boundary. */
[data-theme="contrast"] .btn-secondary { box-shadow: inset 0 0 0 1px var(--oa-ink); }
@media (forced-colors: active) {
  .btn { border: 1px solid ButtonText; }
  .btn-primary { background: ButtonText; color: ButtonFace; }
  a.btn:not(#oa-tier-colour) { color: ButtonText; }
  a.btn.btn-primary:not(#oa-tier-colour), a.btn.btn-primary:not(#oa-tier-colour):hover { color: ButtonFace; }
}

/* ---- Action links --------------------------------------------------------- */
.link-action {
  color: var(--oa-ink);
  font-weight: 500; font-size: 14px; letter-spacing: -0.005em;
  text-decoration: underline; text-decoration-thickness: 1px;
  text-underline-offset: 4px; text-decoration-color: var(--oa-border-strong);
  transition: text-decoration-color 120ms var(--oa-ease), color 120ms var(--oa-ease);
  cursor: pointer;
}
.link-action:hover { color: var(--oa-ink); text-decoration-color: var(--oa-ink); }
.link-action:focus-visible { outline: 2px solid var(--oa-ink); outline-offset: 3px; }
/* Beside a small button, a link-action takes the button's size: one row, one
   type size ("Start with an instruction" and "Just ask something" read as a
   pair, not as a button and a headline). */
.btn-sm ~ .link-action, .link-action:has(~ .btn-sm) { font-size: 13px; }
/* A <button> that is a link-action (Copy MCP URL) loses the button chrome. */
button.link-action {
  -webkit-appearance: none; appearance: none; background: none; border: 0; padding: 0; margin: 0;
  font-family: var(--oa-font); line-height: inherit;
}
/* On a touch screen a text-only action (Copy receipt, Verify the live sample)
   was a 22px line: vertical padding makes it a 34px target without moving it. */
@media (pointer: coarse) { button.link-action { padding-block: 6px; } }

/* A row of actions: one primary, at most one link-action beside it, on one
   centre line. align-items: center is the point -- in a stretched flex row the
   link's box grew to the button's height and its underline sank 20px. */
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }

/* ---- Cards with one action: the whole card is the target ------------------
   .action-card on the card, .card-action on its one .link-action. The link's
   ::before covers the card, so a click anywhere lands on a real <a> (middle
   click, copy link and the status bar all still work). Inline links and
   buttons in the copy sit above that layer. Hover is a border change only:
   no lift, no shadow. */
.action-card { position: relative; transition: border-color 120ms var(--oa-ease); }
.action-card:hover, .action-card:focus-within { border-color: var(--oa-border-strong); }
.action-card .card-action::before { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.action-card :is(a, button, input, select, textarea, summary):not(.card-action) { position: relative; z-index: 1; }

/* ---- Segmented control (tabs and pill toggles) ----------------------------
   .segmented on the tablist, .seg-tab on each tab. The page keeps its own
   roles, aria-selected, ids and roving tabindex; selection is read from
   aria-selected (or aria-pressed / .is-on for toggles that predate it). */
.segmented {
  display: inline-flex; align-items: stretch; gap: 2px;
  padding: 3px; border-radius: var(--radius-sm, 8px); background: var(--oa-soft);
  max-width: 100%; box-sizing: border-box;
  /* Never push the page sideways: a long set scrolls inside its own track.
     The 3px padding is exactly the focus ring's room (2px + 1px offset). */
  overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.seg-tab {
  -webkit-appearance: none; appearance: none; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 34px; padding: 0 12px; margin: 0;
  border: 0; border-radius: calc(var(--radius-sm, 8px) - 3px); background: transparent;
  color: var(--ink-soft, color-mix(in oklab, var(--oa-ink) 78%, var(--oa-bg)));
  font: 500 13.5px/1.2 var(--oa-font); letter-spacing: -0.005em;
  white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color 120ms var(--oa-ease), box-shadow 120ms var(--oa-ease), color 120ms var(--oa-ease);
}
.seg-tab:hover { color: var(--oa-ink); }
.seg-tab[aria-selected="true"], .seg-tab[aria-pressed="true"], .seg-tab.is-on, .seg-tab.on, .seg-tab.active {
  background: var(--oa-surface); color: var(--oa-ink);
  box-shadow: inset 0 0 0 1px var(--oa-border);
}
/* TST-09: a PRESSED toggle (a test verdict, the terminal's route, a view
   switch) was told apart only by its surface fill on the soft track: 1.09:1
   light, 1.15:1 dark, under the 3:1 WCAG 1.4.11 asks of a state indicator.
   Its ring is the ink token, 2px, inside the button: over 15:1 against both
   the fill and the track in both themes (measured in _test/actions-system.mjs
   and journey j41). A selected TAB keeps the quieter 1px border: its panel
   below says which tab is open. */
.seg-tab[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--oa-ink); }
.seg-tab:focus-visible { outline: 2px solid var(--oa-ink); outline-offset: 1px; position: relative; z-index: 1; }
[data-theme="contrast"] .seg-tab[aria-selected="true"], [data-theme="contrast"] .seg-tab.is-on { box-shadow: inset 0 0 0 2px var(--oa-ink); }
/* Forced colours drop the fill and the inset ring, so the chosen tab -- or a
   pressed toggle, such as a test verdict (TST-09) -- is outlined instead. */
@media (forced-colors: active) { .seg-tab[aria-selected="true"], .seg-tab[aria-pressed="true"], .seg-tab.is-on { outline: 2px solid Highlight; } }

/* ---- Disclosure (a list that can fold away) -------------------------------
   Native <details>/<summary>: keyboard and screen-reader behaviour for free.
   Actions that must stay reachable while it is closed (New build, Export all)
   live in .disclosure-actions, a SIBLING laid over the summary row -- not
   inside <summary>, where a click would also toggle the list and a screen
   reader would announce a button inside a button. Open/closed is remembered
   per viewer by js/omni-disclosure.js. */
.disclosure-wrap { position: relative; }
.disclosure > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  min-height: 44px; padding: 4px 0;
  border-radius: var(--radius-sm, 8px);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::marker { content: ""; }
.disclosure > summary:focus-visible { outline: 2px solid var(--oa-ink); outline-offset: 2px; }
.disclosure-caret {
  flex: 0 0 auto; width: 16px; height: 16px; display: inline-block;
  color: var(--ink-mid, color-mix(in oklab, var(--oa-ink) 55%, var(--oa-bg)));
  transition: transform 120ms var(--oa-ease);
}
.disclosure-caret::before {
  content: ""; display: block; width: 6px; height: 6px; margin: 4px 0 0 4px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
}
.disclosure[open] > summary .disclosure-caret { transform: rotate(90deg); }
.disclosure-count { font-size: 12.5px; color: var(--ink-mid, color-mix(in oklab, var(--oa-ink) 55%, var(--oa-bg))); font-variant-numeric: tabular-nums; }
.disclosure-actions { position: absolute; top: 4px; right: 0; display: flex; align-items: center; gap: 8px; z-index: 1; }
.disclosure-wrap > .disclosure > summary { padding-right: var(--disclosure-actions-w, 220px); }
@media (max-width: 560px) {
  .disclosure-actions { position: static; margin: 0 0 4px; }
  .disclosure-wrap > .disclosure > summary { padding-right: 0; }
}

/* ---- Motion ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .btn, .link-action, .seg-tab, .action-card, .disclosure-caret { transition: none; }
}
[data-motion="reduced"] :is(.btn, .link-action, .seg-tab, .action-card, .disclosure-caret) { transition: none; }

/* At 480px and under, a tab and a button in the nav bar are 44px too (r38
   polish): admin's section tabs and the nav's Sign in / Passport were 34-36px.
   Last in the file: it must follow the .seg-tab and .btn-sm rules it raises. */
@media (max-width: 480px) {
  .seg-tab, nav .btn-sm { min-height: 44px; }
}
