/* Comb Code controls motion layer: buttons, links, checkboxes, inputs and tap targets.
   Additive only. Load LAST on the page so it settles conflicts between page styles.
   Owns: press/active states, disabled states, focus cues, tap size, tap highlight,
   double-tap zoom and one consistent check/press motion across every page. */

/* Shared motion language: one natural ease-out curve everywhere, transform/opacity first. */
:root{--cm-ease:cubic-bezier(.2,.8,.2,1);--cm-spring:cubic-bezier(.34,1.4,.64,1)}

/* 1. No tap-highlight boxes and no double-tap zoom anywhere (pinch zoom still works). */
html{-webkit-tap-highlight-color:transparent;touch-action:manipulation}
canvas{touch-action:pan-y}

/* 2. Every control state change animates, nothing snaps. */
a,button,[role="button"],summary,input,select,textarea,label{
  transition:color .18s var(--cm-ease),background-color .18s var(--cm-ease),border-color .18s var(--cm-ease),
             opacity .18s var(--cm-ease),filter .18s var(--cm-ease),box-shadow .18s var(--cm-ease),transform .14s var(--cm-ease)}

/* 3. One consistent press feel on every tappable control. */
button:not(:disabled):not([disabled]):active,
.btn:not([disabled]):active,
[role="button"]:active,
summary:active,
a.scanpill:active{transform:scale(.97)}
label.opt:active{transform:scale(.99)}

/* 4. Tap targets: a finger always gets at least 44px. */
button,.btn,[role="button"],a.scanpill{min-height:44px}
.sitebar .scanpill{min-height:44px;align-items:center}
select{min-height:44px}
main .result .controls button{min-height:44px}
main .options label{min-height:44px}
nav[role=tablist] button{min-height:44px}

/* 5. Focus is a soft neutral ring on fields and a subtle dim on controls.
      Never an outline box. */
:focus-visible{outline:none!important}
textarea:focus,select:focus,input:focus{outline:none!important}
textarea:focus,select:focus,
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):focus{
  border-color:#9a9597;box-shadow:0 0 0 3px rgba(0,0,0,.12)}
.rf-zone:focus-visible{box-shadow:0 0 0 4px rgba(0,0,0,.14)}

/* 6. Checkboxes: one design on every page, with an animated tick and a tap pop. */
input[type=checkbox]{
  appearance:none;-webkit-appearance:none;
  width:22px;height:22px;min-width:22px;min-height:22px;margin:0;
  border:1.5px solid #c7c2c4;border-radius:7px;background:#fff;
  position:relative;display:inline-block;vertical-align:-5px;
  cursor:pointer;flex:none}
input[type=checkbox]:checked{background:#2E5BFF;border-color:#2E5BFF;animation:cm-pop .24s var(--cm-ease)}
input[type=checkbox]::after{
  content:"";position:absolute;left:50%;top:44%;
  width:10px;height:5px;
  border-left:2.4px solid #fff;border-bottom:2.4px solid #fff;
  transform:translate(-50%,-62%) rotate(-45deg) scale(0);
  transition:transform .18s var(--cm-spring)}
input[type=checkbox]:checked::after{transform:translate(-50%,-62%) rotate(-45deg) scale(1)}
input[type=checkbox]:not(:disabled):active{transform:scale(.86)}
input[type=checkbox]:disabled{opacity:.4;cursor:default}
input[type=checkbox]:focus-visible{box-shadow:0 0 0 3px rgba(0,0,0,.18)}
@keyframes cm-pop{0%{transform:scale(1)}45%{transform:scale(1.14)}100%{transform:scale(1)}}

/* Spacing where a checkbox sits inside a plain (non-flex) text label. */
.options label input[type=checkbox]{margin-right:8px}

/* Debug-trace checkbox carries an inline !important 18px size; match the standard box. */
.traceToggle input[type=checkbox]{width:22px!important;height:22px!important;min-width:22px!important;min-height:22px!important}

/* Option cards keep their checkbox aligned with the first line. */
.opt input[type=checkbox]{margin:4px 0 0}


@media (prefers-reduced-motion:reduce){
  input[type=checkbox]:checked{animation:none}
  input[type=checkbox]::after{transition:none}
}

/* 7. Native file-picker button gets the same press feel and motion. */
::file-selector-button{
  transition:filter .18s var(--cm-ease),background-color .18s var(--cm-ease),border-color .18s var(--cm-ease),transform .14s var(--cm-ease);
  cursor:pointer}
input[type=file]:active::file-selector-button{transform:scale(.97);filter:brightness(.94)}

/* 8. Page-specific button rules that replaced the transition property get it back in full,
      so hovers and presses glide instead of snapping. */
.controls button,main button,main .photo{
  transition:background-color .18s var(--cm-ease),background .18s var(--cm-ease),color .18s var(--cm-ease),
             border-color .18s var(--cm-ease),opacity .18s var(--cm-ease),filter .18s var(--cm-ease),
             box-shadow .18s var(--cm-ease),transform .14s var(--cm-ease)}

/* 9. Hover lift on real pointers: a 1px rise with a soft shadow, settling back into the press. */
@media(hover:hover) and (pointer:fine){
  button:not(:disabled):not([disabled]):hover,
  .btn:not([disabled]):hover,
  [role="button"]:hover,
  a.scanpill:hover,
  .rf-zone:hover{transform:translateY(-1px)}
  button:not(:disabled):not([disabled]):hover:active,
  .btn:not([disabled]):hover:active,
  [role="button"]:hover:active,
  a.scanpill:hover:active{transform:translateY(0) scale(.97)}
}

/* 10. Expert-mode checkbox becomes a switch: the knob slides with the spring curve. */
.expertSwitch input[type=checkbox]{
  width:44px;height:26px;min-width:44px;min-height:26px;
  border:0;border-radius:999px;background:#d8d3d5;vertical-align:middle}
.expertSwitch input[type=checkbox]::after{
  left:3px;top:50%;width:20px;height:20px;border:0;border-radius:50%;
  background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.28);
  transform:translate(0,-50%);
  transition:transform .22s var(--cm-spring)}
.expertSwitch input[type=checkbox]:checked{background:#2E5BFF;animation:none}
.expertSwitch input[type=checkbox]:checked::after{transform:translate(18px,-50%)}
.expertSwitch input[type=checkbox]:not(:disabled):active::after{width:23px}

/* 11. Controls rise into place when a page loads: 6px fade-up, 40ms stagger, once. */
@media(prefers-reduced-motion:no-preference){
  @keyframes cm-rise{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
  .actions>*,.bigActions>*,.controls>button{animation:cm-rise .3s var(--cm-ease) both}
  .actions>*:nth-child(2),.bigActions>*:nth-child(2),.controls>button:nth-child(2){animation-delay:.04s}
  .actions>*:nth-child(3),.bigActions>*:nth-child(3),.controls>button:nth-child(3){animation-delay:.08s}
  .actions>*:nth-child(4),.bigActions>*:nth-child(4),.controls>button:nth-child(4){animation-delay:.12s}
  .actions>*:nth-child(n+5),.bigActions>*:nth-child(n+5),.controls>button:nth-child(n+5){animation-delay:.16s}
}

/* 12. Page-to-page moves cross-fade on browsers that support it (Chrome/Android). */
@view-transition{navigation:auto}
@media(prefers-reduced-motion:reduce){@view-transition{navigation:none}}

/* 6b. Tickets/cards injected UI (comb-cards.js appends its own <style> after this sheet): keep the 44px tap floor with higher specificity. */
body .pccard button,body .pcbar button{min-height:44px}
body .pcform input,body .pcform select{min-height:44px}

/* 6c. Parts panel (comb-parts.css sets transition:none on these): keep state changes animated. */
.pp-chev{transition:transform .18s var(--cm-ease)}
.pp-card.pp-dark .pp-body button{transition:color .18s var(--cm-ease),background-color .18s var(--cm-ease),border-color .18s var(--cm-ease),opacity .18s var(--cm-ease),filter .18s var(--cm-ease),box-shadow .18s var(--cm-ease),transform .14s var(--cm-ease)}

.plan a{display:inline-flex;align-items:center;min-height:44px;touch-action:manipulation}
.toc a,.ds table td a,header > a,.split a.more{display:inline-flex;align-items:center;min-height:44px}
/* Standalone .json links keep a 44px tap target via vertical padding, which does not inflate the inline line box (a11y.css footer pattern). Matches only when the link is the paragraph's sole element child, so inline text links (docs Verified issuers) are not stretched. */
p > a[href$=".json"]:only-child{padding-top:13px;padding-bottom:13px}
input[type=file]{min-height:44px}
@media(hover:hover) and (pointer:fine){.split a.more:hover{text-decoration:underline;text-underline-offset:3px}}
summary{transition:opacity .15s ease}
@media(hover:hover) and (pointer:fine){summary:hover{opacity:.72}}
.pager{display:flex;flex-wrap:wrap;gap:0 22px;font-size:0}.pager a{display:inline-flex;align-items:center;min-height:44px;font-size:16px}
/* Keyboard focus is always visible, never a box: links underline and dim, summaries dim, controls dim. */
a:focus-visible{text-decoration:underline!important;text-underline-offset:3px;text-decoration-thickness:2px;opacity:.6}
summary:focus-visible,[role=tab]:focus-visible{opacity:.6}
button:focus-visible,[role=button]:focus-visible,label:focus-visible{filter:brightness(.93)}
select:focus-visible,input:focus-visible,textarea:focus-visible,[role=button]:focus-visible{filter:brightness(.93)}
