/* The start page: the music screen (particles, Press & Hold, the popup) and the tools that stay on every
   screen (language, sound). Layout of the work screen: work.css. */
html,body{width:100%;height:100%;overflow:hidden;overscroll-behavior:none}
canvas{position:absolute;inset:0;width:100%;height:100%;display:block}

/* ---- stage: the particles' canvas and what lies on it ---- */
.stage{position:fixed;inset:0;touch-action:none;cursor:crosshair;transition-property:opacity;transition-timing-function:ease}
.stage[data-phase="leaving"],.stage[data-phase="returning"]{pointer-events:none}
.stage[data-phase="leaving"] .pop{opacity:0;transition-property:opacity;transition-duration:inherit;transition-timing-function:ease}

/* Press & Hold: the words stand in a quiet valley of the particles (particles/plate.js measures this box). */
.hold-label{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:grid;justify-items:center;width:min(384px,calc(100% - 2 * var(--space-8)));pointer-events:none;color:var(--ink);transition:opacity var(--dur-ui) ease}
/* The tracking also follows the last letter: the same space before the first keeps the words centred. */
.hold-text{min-height:36px;display:grid;align-items:center;padding-left:var(--track-intro);text-align:center;font:400 var(--type-intro)/var(--leading-text) var(--font-mono);letter-spacing:var(--track-intro);text-wrap:balance;overflow-wrap:anywhere}
.stage:not([data-ready]) .hold-label{opacity:.3}
.stage:not([data-phase="gather"]) .hold-label{display:none}
.hold-key:focus-visible + .hold-label{outline:var(--focus-ring);outline-offset:var(--space-2)}

/* ---- popup: the portfolio's card over the figure, with its three actions ---- */
/* The actions keep their own --space-3 under the words, so the card's bottom padding is that much smaller. */
.pop{--pop-pad:var(--space-8);position:absolute;left:50%;top:50%;width:min(720px,calc(100% - 2 * var(--space-4)));padding:var(--pop-pad) var(--pop-pad) calc(var(--pop-pad) - var(--space-3));background:var(--surface-veil);-webkit-backdrop-filter:blur(var(--blur-glass));backdrop-filter:blur(var(--blur-glass));border:var(--hairline) solid var(--line-soft);color:var(--ink);pointer-events:none;opacity:0;transform:translate(-50%,calc(-50% + 14px));filter:blur(var(--blur-enter));transition:opacity var(--dur-pop) var(--ease-pop),transform var(--dur-pop) var(--ease-pop),filter var(--dur-pop) var(--ease-pop)}
.pop.on{opacity:1;transform:translate(-50%,-50%);filter:none}
.pop-title{margin:0;font:400 var(--type-title)/var(--leading-ui) var(--font-ui);text-wrap:balance;overflow-wrap:anywhere}
.pop-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--space-4);margin-top:var(--space-6)}
/* An action: a line on top, the words, and an arrow on the right. While it is not open there is no arrow and
   the "soon" mark stands under the words, so the words keep the whole width and do not break. */
.pop-action{pointer-events:auto;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:var(--space-2);min-height:var(--control-size);padding:var(--space-3) 0;border:0;border-top:var(--hairline) solid var(--line);background:none;text-align:left;font:400 var(--type-control)/var(--leading-text) var(--font-ui);color:var(--ink);cursor:pointer}
.pop-action-label{overflow-wrap:anywhere}
.pop-action:enabled:hover{border-color:var(--ink)}
.pop-action:focus-visible{outline:var(--focus-ring);outline-offset:var(--space-1)}
.pop-action:disabled{grid-template-columns:minmax(0,1fr);row-gap:var(--space-1);color:var(--ink-secondary);cursor:default}
.pop-action .soon{justify-self:start}

/* ---- tools: language and sound, top right on every screen ----
   Mirror of "Back": the icon, not its 44px target, stands on the page frame, so the target reaches past it. */
.tools{position:fixed;top:var(--page-pad);right:calc(var(--page-pad) - (var(--control-size) - var(--icon-size)) / 2);display:flex;z-index:var(--z-tools)}
.language{position:relative}
.langs{position:absolute;right:0;top:calc(100% + var(--space-2));margin:0;padding:var(--space-2);list-style:none;background:var(--paper);border:var(--hairline) solid var(--line);min-width:176px}
.langs button{display:block;width:100%;min-height:var(--control-size);text-align:left;border:0;background:none;padding:var(--space-2) var(--space-3);font:400 var(--type-control)/var(--leading-text) var(--font-ui);color:var(--ink);cursor:pointer}
.langs button:hover,.langs button:focus-visible{background:var(--tint-hover);outline:none}
.langs button[aria-current="true"]{text-decoration:underline;text-underline-offset:var(--space-1)}
.sound .off{display:none}.sound[aria-pressed="true"] .on{display:none}.sound[aria-pressed="true"] .off{display:inline}

.error{position:absolute;left:50%;top:var(--space-4);transform:translateX(-50%);font:13px var(--font-mono);color:var(--danger)}

/* Narrow windows: the actions stand one under the other. */
@media (max-width:600px){.pop{--pop-pad:var(--space-4)}.pop-title{min-height:2.8em}.pop-actions{grid-template-columns:1fr;gap:0;margin-top:var(--space-4)}}
@media (prefers-reduced-motion:reduce){.hold-label,.pop{transition-duration:.01ms}.pop{filter:none}}
