/* Mythril motion: the moving parts every screen shares, in one place.
   Loaded after the page sheets, so it finishes what each of them starts. Its script is
   js/motion.js. Everything here answers something a person did: a tab chosen,
   a group folded, a row ticked, a pointer resting on a control. Nothing plays
   by itself. Reduce motion (the device setting, or html.my-calm) keeps every
   state change and drops the travel; that block is at the end of this file. */

/* ── The parts of the browser nobody drew ───────────────────────────────── */
/* Plain colours on purpose: these reach the map, whose PDF export cannot read color-mix(). */
html{ scrollbar-color:rgba(27,33,48,.24) transparent; accent-color:var(--gold, #c9a03f); }
html[data-theme="dark"]{ scrollbar-color:rgba(255,255,255,.22) transparent; }
.lh-sidebar, .lh-sidebar *{ scrollbar-color:rgba(255,255,255,.22) transparent; }
::selection{ background:rgba(201,160,63,.34); }
input, textarea, [contenteditable="true"]{ caret-color:var(--gold-dark, #b08a2e); }
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] [contenteditable="true"]{ caret-color:#e2c27a; }

/* ── The selection glides ───────────────────────────────────────────────── */
/* js/motion.js lends the newly chosen tab a copy of its own tile, which
   travels from the tab that was current. While it travels the tab's own tile
   is held back, so there is only ever one. */
.my-glide{ position:absolute; z-index:-1; pointer-events:none; transform-origin:0 0; will-change:transform; }
.my-gliding{ transition:none !important; isolation:isolate; overflow:visible !important; background-color:transparent !important; background-image:none !important; box-shadow:none !important; border-color:transparent !important; }
.my-gliding-rel{ position:relative; }
/* The tile passes under the other tabs' words, never over them. */
.my-glide-row{ isolation:isolate; }
.my-glide-row > .my-gliding{ z-index:-1 !important; }

/* The boards' own tab tiles (css/page-crm.css) travel on the same spring. */
.crm-tab-active.crm-pill-slide::before,
.crm-tab2-on.crm-pill-slide::before{ animation-duration:.42s; animation-timing-function:var(--my-spring, cubic-bezier(.34,1.5,.64,1)); }
/* No line under a chosen view: the tile is the mark. */
.crm-view-active.crm-pill-slide::after,
.crm-tab2-on.crm-pill-slide::after{ content:none; }

/* ── The rail ───────────────────────────────────────────────────────────── */
.lh-nav-item svg, .lh-side-link svg{ transition:transform .3s var(--my-spring, cubic-bezier(.34,1.5,.64,1)); }
.lh-nav-item:hover svg, .lh-side-link:hover svg{ transform:scale(1.1); }
.lh-nav-item:active svg, .lh-side-link:active svg{ transform:scale(.88); transition-duration:.08s; }
.lh-nav-item.active svg{ animation:my-icon-in .5s var(--my-spring, cubic-bezier(.34,1.5,.64,1)); }
@keyframes my-icon-in{ from{ transform:scale(.6) rotate(-8deg); } to{ transform:none; } }

/* ── Board groups fold as one sheet ─────────────────────────────────────── */
.my-fold{ overflow:hidden; pointer-events:none; }
.my-fold > .crm-tablewrap{ overflow:hidden; }
.my-opening{ overflow:hidden !important; }
/* While its table is still closing, the band keeps its square lower corners. */
.crm-group.my-folding > .crm-group-head, .fin-group.my-folding > .crm-group-head{ border-bottom-left-radius:0; border-bottom-right-radius:0; }
/* js/motion.js opens the sheet; the old fade would fight it. */
.crm-group.crm-fold-enter > .crm-tablewrap{ animation:none; }
.crm-caret{ transition:transform .3s var(--my-ease-out, cubic-bezier(.22,1,.36,1)); }

/* ── Pop-ups, menus and cards leave the way they came ───────────────────── */
/* js/motion.js fades a copy of what the screen has just removed. */
/* Nothing inside the copy may start arriving again while the copy is leaving. */
.my-leaving, .my-leaving *, .my-leaving *::before, .my-leaving *::after{ animation:none !important; transition:none !important; pointer-events:none !important; }

/* ── Ticking a row: the square fills and the tick is drawn ──────────────── */
.crm-rowsel::after{
  content:""; position:absolute; inset:0; border:0; width:auto; height:auto; left:0; top:0; transform:none;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.6 8.4l2.9 2.9 5.9-6.2'/%3E%3C/svg%3E") center/12px 12px no-repeat;
  clip-path:inset(0 100% 0 0); transition:clip-path .12s ease-in;
}
.crm-rowsel-on::after{
  content:""; position:absolute; inset:0; border:0; width:auto; height:auto; left:0; top:0; transform:none;
  clip-path:inset(0 0 0 0); transition:clip-path .28s var(--my-ease-out, cubic-bezier(.22,1,.36,1)) .05s;
}
[data-theme="dark"] .crm-rowsel::after{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%231f2533' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.6 8.4l2.9 2.9 5.9-6.2'/%3E%3C/svg%3E");
}

/* ── Controls that did not answer the pointer ───────────────────────────── */
.dash-filt:not([aria-pressed="true"]):hover{ background:color-mix(in oklab, var(--text-strong, #1b2130) 6%, transparent); color:var(--text-strong); }
.admin-tab{ transition:color .15s var(--my-ease-std, ease), background-color .15s var(--my-ease-std, ease); }
.admin-tab:not(.active):hover{ color:var(--text-strong); }
.admin-api .ak-go{ transition:text-decoration-color .15s ease, color .15s ease; }
.admin-api .ak-go:hover{ text-decoration-color:currentColor; }

/* Text buttons and links changed colour in one frame; now they ease. */
.dash-link, .od-link, .od-task-t, .od-check, .crm-sync-btn, .crm-build, .set-link, .pw .linkbtn, .rp-n{
  transition:color .15s var(--my-ease-std, ease), text-decoration-color .15s var(--my-ease-std, ease), background-color .15s var(--my-ease-std, ease), border-color .15s var(--my-ease-std, ease);
}
.crm-table thead th{ transition:background-color .15s var(--my-ease-std, ease), color .15s var(--my-ease-std, ease); }
/* Finance: the info dots, site names and month carets ease, and the caret answers the pointer. */
.fin-info, .fin-open, .an-metric-btn{ transition:color .15s var(--my-ease-std, ease), background-color .15s var(--my-ease-std, ease), text-decoration-color .15s var(--my-ease-std, ease), box-shadow .15s var(--my-ease-std, ease); }
.fin-open{ text-decoration:underline; text-decoration-color:transparent; text-underline-offset:3px; }
.fin-root .fin-group .pw-gtoggle{ transition:color .15s var(--my-ease-std, ease); }
.fin-root .fin-group .pw-gtoggle:hover{ color:var(--text-strong); }

/* ── Reduce motion: every state still changes, nothing travels ──────────── */
@media (prefers-reduced-motion: reduce){
  .my-glide{ display:none; }
  .lh-nav-item svg, .lh-side-link svg{ transition:none; }
  .lh-nav-item:hover svg, .lh-side-link:hover svg, .lh-nav-item:active svg, .lh-side-link:active svg{ transform:none; }
  .lh-nav-item.active svg{ animation:none; }
  .crm-caret{ transition:none; }
  .crm-rowsel::after, .crm-rowsel-on::after{ transition:none; }
}
html.my-calm .my-glide{ display:none; }
html.my-calm :is(.lh-nav-item, .lh-side-link):is(:hover, :active) svg{ transform:none; }

/* ── The board's status picker ────────────────────────────────────────────
   A list of rows, each led by its own colour, in place of a wall of solid
   blocks. Hovering a row washes it in that colour (a faded layer of --sw,
   which the row carries inline), so the colour still names the status. */
.crm-status-menu{ gap:1px; padding:6px 6px 8px; scrollbar-width:thin; }
.crm-status-menu .crm-menu-phase{
  font-size:11.5px; font-weight:600; letter-spacing:0; text-transform:none;
  color:var(--crm-ink-3); padding:12px 9px 5px;
}
.crm-status-menu .crm-menu-phase:first-child{ padding-top:6px; }
.crm-status-menu .crm-menu-chip{
  position:relative; isolation:isolate; min-height:34px; line-height:1.3;
  background:transparent; transition:color .12s ease;
}
.crm-status-menu .crm-menu-chip::before{
  content:""; position:absolute; inset:0; z-index:-1; border-radius:inherit;
  background:var(--sw, currentColor); opacity:0;
  transition:opacity .14s cubic-bezier(.2,0,0,1);
}
.crm-status-menu .crm-menu-chip:hover{ background:transparent; }
.crm-status-menu .crm-menu-chip:hover::before,
.crm-status-menu .crm-menu-chip:focus-visible::before{ opacity:.14; }
.crm-status-menu .crm-menu-chip:active::before{ opacity:.24; }
.crm-status-menu .crm-menu-current::before{ opacity:.12; }
.crm-status-menu .crm-menu-swatch{
  width:12px; height:12px; border-radius:4px;
  transition:scale .16s cubic-bezier(.2,0,0,1);
}
.crm-status-menu .crm-menu-chip:hover .crm-menu-swatch{ scale:1.18; }
.crm-status-menu .crm-menu-t{ flex:1 1 auto; min-width:0; }
.crm-status-menu .crm-menu-current::after{ color:var(--crm-ink); }
.crm-status-menu .crm-menu-clear{
  margin-top:8px; padding:8px 9px; text-align:left;
  transition:background-color .12s ease, color .12s ease;
}
@media (prefers-reduced-motion: reduce){
  .crm-status-menu .crm-menu-chip, .crm-status-menu .crm-menu-chip::before,
  .crm-status-menu .crm-menu-swatch{ transition:none; }
  .crm-status-menu .crm-menu-chip:hover .crm-menu-swatch{ scale:none; }
}
html.my-calm .crm-status-menu .crm-menu-chip::before,
html.my-calm .crm-status-menu .crm-menu-swatch{ transition:none; }
@media (pointer: coarse){
  .crm-status-menu .crm-menu-chip, .crm-status-menu .crm-menu-clear{ min-height:44px; }
}
