/* The app switch (js/apps.js): a button with the apps' grid, a small menu of the three apps, and the window that
   grows out of an app's icon when it opens. Used by the Hub, the Match Coder and PSstudio, so it uses only the colour
   names the three share (--card, --ink, --ink-2, --ink-3, --line), with their own values in each. */

/* the page itself grows out of the icon between the Match Coder and PSstudio (same address); js/apps.js runs it and
   skips every other transition, and with reduced motion there is none */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}
html.apps-vt::view-transition-old(root),
html.apps-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* after a panel: the page fades in on the panel's colour */
html.apps-arrive { background: var(--apps-arrive); }
html.apps-arrive body { animation: apps-in 0.3s ease-out both; }
@keyframes apps-in { from { opacity: 0; } }

.apps-panel { position: fixed; inset: 0; z-index: 2147483000; display: grid; place-items: center; pointer-events: none; }
.apps-panel .apps-mark { width: min(40vw, 280px); height: auto; }

/* the button */
.apps-grid { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; }
.apps-btn { cursor: pointer; }
.apps-btn[aria-expanded="true"] { color: var(--ink); }
.apps-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* in the Hub's menu, next to Match Coder: as quiet as the menu's words */
.apps-slot { display: inline-flex; align-items: center; }
.mainnav a[data-route="coder"] + .apps-slot { margin-left: -24px; }
.apps-btn.apps-nav { width: 30px; height: 30px; margin: -4px 0; border-radius: 8px; display: grid; place-items: center; color: var(--ink-2); background: transparent; transition: background 0.15s ease, color 0.15s ease; }
.apps-btn.apps-nav:hover, .apps-btn.apps-nav[aria-expanded="true"] { color: var(--ink); background: var(--head, rgba(127, 127, 127, 0.14)); }
/* PSstudio's top bar: the size of its other small controls */
.apps-btn.apps-st { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: var(--r, 2px); color: var(--ink-2); background: transparent; border: 0; padding: 0; }
.apps-btn.apps-st:hover, .apps-btn.apps-st[aria-expanded="true"] { color: var(--ink); background: var(--chip, rgba(127, 127, 127, 0.18)); }
.apps-btn.apps-st .apps-grid { width: 17px; height: 17px; }
.apps-btn.apps-st:focus-visible { outline: none; box-shadow: var(--focus, 0 0 0 1px rgba(242, 242, 244, 0.6)); }

/* the menu: the three apps side by side, like icons in a dock */
.apps-menu { position: fixed; z-index: 1000; padding: 8px; border-radius: 14px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08); font-family: Barlow, system-ui, sans-serif; }
.apps-on-studio { border-radius: 6px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
.apps-list, .apps-row { display: flex; gap: 4px; }
.apps-item { position: relative; display: grid; justify-items: center; align-content: start; gap: 6px; width: 84px; padding: 10px 4px 12px;
  border-radius: 10px; color: var(--ink); text-decoration: none; font: 600 12.5px/1.15 Barlow, system-ui, sans-serif; text-align: center; }
.apps-on-studio .apps-item { border-radius: 4px; }
.apps-item:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.apps-item:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.apps-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.22); }
.apps-icon .apps-mark { width: 30px; height: auto; }
.apps-name { white-space: nowrap; }
/* the app open now: a dot under its name, as in a dock */
.apps-dot { width: 4px; height: 4px; border-radius: 50%; background: transparent; margin-top: -2px; }
.apps-item[aria-current="page"] .apps-dot { background: var(--ink); }
.apps-item[aria-current="page"] { cursor: default; }
/* an app outside the account's licence: greyed, with the reason, and not a link */
.apps-item[aria-disabled="true"] { cursor: default; color: var(--ink-3); }
.apps-item[aria-disabled="true"]:hover { background: transparent; }
.apps-item[aria-disabled="true"] .apps-icon { filter: grayscale(1); opacity: 0.4; }
.apps-off { margin-top: -2px; font-size: 10.5px; font-weight: 600; line-height: 1.2; color: var(--ink-3); white-space: normal; }
.apps-note { margin: 6px 4px 2px; max-width: 252px; color: var(--ink-2); font: 500 12.5px/1.35 Barlow, system-ui, sans-serif; }
.apps-note[hidden] { display: none; }

/* the Hub's phone menu: the three in a row where Match Coder was */
.hmenu .apps-row { padding: 6px 12px 8px; border-top: 1px solid var(--line); justify-content: flex-start; }
.hmenu .apps-row .apps-item { display: grid; width: 84px; padding: 8px 4px 10px; border-top: 0; font-size: 12.5px; font-weight: 600; justify-content: initial; }
.hmenu .apps-row .apps-item::after { content: none; }

@media (prefers-reduced-motion: reduce) {
  html.apps-arrive body { animation: none; }
}
