/* <valt-menu>. The constant chip: mode-invariant, a mark rather than a themed control.
 * Its panel keeps the head still and uncovers the rows beneath it (the "mask" motion). */
valt-menu { position: fixed; left: var(--gutter); top: var(--chrome-top); z-index: 8; display: block; font-family: var(--font); }

valt-menu .chip { position: relative; width: var(--tap); height: var(--tap); border: 0; padding: 0; border-radius: var(--r-control);
  display: grid; place-items: center; cursor: pointer; color: var(--chip-ink); background: var(--chip);
  box-shadow: inset 0 0 0 1px var(--chip-ring); -webkit-appearance: none;
  transition: transform var(--t-feedback) var(--ease), visibility 0s; }
/* Additive veil, not brightness(): a multiplicative filter cannot lift a near-black chip. */
valt-menu .chip::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: var(--chip-veil); opacity: 0; transition: opacity var(--t-feedback) var(--ease); }
valt-menu .chip:hover::before { opacity: 1; }
valt-menu .chip:active { transform: scale(.93); }
valt-menu .chip:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* visibility, not opacity: opacity leaves a phantom tab stop with an invisible ring. */
valt-menu[open] .chip { visibility: hidden; pointer-events: none; }

valt-menu .scrim { position: fixed; inset: 0; z-index: -1; }

/* The panel is the sort sheet's material: the app's glass at radius 20,
 * a grey ring at 40%, neutral hairlines between rows, and a top light that arrives from the chip's corner when
 * the panel opens. The glass adapts by day, so the inks are the theme's; the chip itself stays constant. */
valt-menu { --menu-edge: #5A5A5E; }
[data-theme="day"] valt-menu { --menu-edge: #8C8980; }
valt-menu .panel { position: absolute; top: 0; left: 0; width: 182px; border-radius: 20px; overflow: hidden;
  display: flex; flex-direction: column; background: var(--glass-panel); color: var(--text);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(130%); backdrop-filter: blur(var(--glass-blur)) saturate(130%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--menu-edge) 40%, transparent), var(--shadow-menu); }
valt-menu .panel::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, var(--menu-edge) 30%, var(--menu-edge) 70%, transparent 100%); }
/* The light lands from the left, the side the chip is on: 600ms on --travel, the travel being the point. */
valt-menu[open] .panel::after { animation: valt-menu-lit 600ms var(--travel) both; }
@keyframes valt-menu-lit { 0% { transform: translateX(-70%); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateX(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  valt-menu[open] .panel::after { animation: valt-menu-lit-fade var(--t-feedback) ease-out both; }
  @keyframes valt-menu-lit-fade { from { opacity: 0; } to { opacity: 1; } }
}
valt-menu .panel[hidden] { display: none; }
valt-menu[closing] .panel { animation: valt-menu-exit var(--t-feedback) var(--ease) both; }
valt-menu .head { height: var(--tap); flex: none; display: flex; align-items: center; padding: 0 13px 0 12.5px; color: var(--text); }
valt-menu .head .mark { display: inline-flex; }
/* The version tag, across from the mark: right edge in line with the rows', tabular so it lines up
 * build to build, and a quieter ink so it reads as a fact about the app, not a row. */
valt-menu .head .tag { margin-left: auto; font: 500 11px/1 var(--font); letter-spacing: 0; font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--text) 60%, transparent); }
valt-menu .head .tag[hidden] { display: none; }
valt-menu .level { display: flex; flex-direction: column; }
valt-menu .level[hidden] { display: none; }
valt-menu[open] .level { animation: valt-menu-uncover 400ms var(--travel); }
/* A level reached from the other arrives from the side it was reached from, over the panel's
 * height change (menu.js sets both). The uncover is the panel opening; this is the panel turning. */
valt-menu[open] .level[data-from="right"] { animation: valt-menu-level-right var(--t-move) var(--ease); }
valt-menu[open] .level[data-from="left"] { animation: valt-menu-level-left var(--t-move) var(--ease); }
valt-menu .panel.sizing { transition: height var(--t-move) var(--travel); }
/* A row is an <a> that navigates or the <button> that switches; the resets keep the two identical. */
valt-menu .row { display: flex; align-items: center; gap: 10px; width: 100%; height: var(--tap); padding: 0 13px 0 16px; box-sizing: border-box;
  margin: 0; border: 0; background: transparent; text-decoration: none; text-align: left; cursor: pointer; -webkit-appearance: none;
  color: var(--text); font: 500 13px/1 var(--font); letter-spacing: -.01em; outline: none;
  box-shadow: inset 0 1px 0 var(--border); transition: background var(--t-feedback) var(--ease); }
valt-menu .row:hover { background: var(--glass-cap); }
valt-menu .row:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; border-radius: var(--r-control); }
valt-menu .row > svg { flex: none; color: var(--text-2); }

/* Dev: the board's row, set apart by the panel edge as its rule and a quieter ink and icon, so it
 * reads as the workbench under the product rather than a fifth destination. Its chevron says a
 * level follows. Hidden unless main.js turns it on; a Production shell never sees it. */
valt-menu .row.dev { box-shadow: inset 0 1px 0 var(--glass-control-line); }
valt-menu .row[hidden] { display: none; }
valt-menu .row.dev,
valt-menu .level.dev .row:not(.back) { color: color-mix(in srgb, var(--text) 72%, transparent); }
valt-menu .row.dev > svg:first-child,
valt-menu .level.dev .row:not(.back) > svg { color: color-mix(in srgb, var(--text-2) 72%, transparent); }
valt-menu .row.dev > svg:last-child { margin-left: auto; transform: rotate(-90deg); }
/* The Dev level's first row names it and is the way back: full ink, the arrow where the icon goes. */
valt-menu .level.dev .row.back { font-weight: 600; }

/* The Day mode switch. The panel is the app's glass now, so the switch reads against the theme: the track is a dim of the panel ink until it is on, then focus teal (a
 * checked control, DESIGN.md; never signal green, which is action). The knob is the panel ink and
 * carries the glyph in the panel colour. Movement is the knob's travel and the moon filling into a
 * sun, one --t-move on the travel curve; the rays unfold a beat after the disc is whole. */
valt-menu .switch .track { position: relative; flex: none; margin-left: auto; width: 38px; height: 22px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--text) 16%, transparent); box-shadow: inset 0 0 0 1px var(--border);
  transition: background var(--t-move) var(--travel), box-shadow var(--t-move) var(--travel); }
valt-menu .switch[aria-checked="true"] .track { background: var(--focus); box-shadow: inset 0 0 0 1px transparent; }
valt-menu .switch .knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: var(--r-pill); background: var(--text);
  display: grid; place-items: center; box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  transform: translateX(0) rotate(-24deg); transition: transform var(--t-move) var(--travel); }
valt-menu .switch[aria-checked="true"] .knob { transform: translateX(16px) rotate(0deg); }
valt-menu .switch .knob svg { display: block; width: 14px; height: 14px; overflow: visible; color: var(--canvas); }
valt-menu .switch .knob .disc,
valt-menu .switch .knob .bite,
valt-menu .switch .knob .rays { transform-box: view-box; transition: transform var(--t-move) var(--travel), opacity var(--t-feedback) var(--ease); }
valt-menu .switch .knob .disc { fill: var(--canvas); transform-origin: 12px 12px; }
valt-menu .switch .knob .bite { fill: var(--text); transform-origin: 15.2px 8.8px; }
valt-menu .switch .knob .rays { fill: none; stroke: var(--canvas); stroke-width: 2.2; stroke-linecap: round; transform-origin: 12px 12px; transform: scale(.35); opacity: 0; }
valt-menu .switch[aria-checked="true"] .knob .disc { transform: scale(.8); }
valt-menu .switch[aria-checked="true"] .knob .bite { transform: translate(10px, -10px) scale(.2); }
valt-menu .switch[aria-checked="true"] .knob .rays { transform: scale(1); opacity: 1; transition-delay: 70ms; }

@keyframes valt-menu-uncover { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes valt-menu-exit { to { opacity: 0; } }
@keyframes valt-menu-level-right { from { opacity: 0; transform: translateX(10px); } }
@keyframes valt-menu-level-left { from { opacity: 0; transform: translateX(-10px); } }

/* Tucked (menu.js tuck): while the server list goes down the chip slides off the top edge with the
 * dock (dock.css --dock-tuck) and comes back with it on any scroll up, so a list read with the thumb has the whole
 * height and the menu is one flick away. Never while the keyboard's focus is on the chip (menu.js data-kbd-focus), and
 * a panel opened while tucked (VoiceOver reaches the chip off-screen) brings the host back so it opens on screen. */
valt-menu { transition: translate var(--t-move) var(--ease); }
valt-menu[data-tucked]:not([data-kbd-focus]):not([open]) { translate: 0 calc(-1 * (var(--chrome-top) + var(--tap) + 8px)); }
@media (prefers-reduced-motion: reduce) { valt-menu { transition: none; } }
