/* shell.css -- Nova's shell (Nova 1.35.0): toasts, the sliding pill of segmented controls, the Music page's
   Spotify app block. Loaded after styles.css. Colours from themes.css, sizes from the type scale. */

/* ========================================
   1. Toasts (renderer/keyboard-ui.js showToast)
   A stack at the top right, level with the tab bar (its right end is empty), newest on top. Each slot's row opens
   as it comes in and closes as it goes, so the others move instead of jumping. In and out are straight up.
   ======================================== */
.toast-stack {
  position: fixed; top: var(--toast-top, 64px); right: 12px; z-index: 10002;
  display: flex; flex-direction: column; align-items: flex-end;
  width: min(340px, calc(100vw - 24px)); pointer-events: none;
}
.toast-slot {
  width: 100%; box-sizing: border-box; display: flex; justify-content: flex-end; align-items: flex-start; padding-bottom: 8px;
  transition: height 140ms var(--snap-ease, ease-out), padding 140ms var(--snap-ease, ease-out);
}
.toast-slot.leaving { overflow: hidden; padding-bottom: 0; pointer-events: none; }
.toast-slot.entering { padding-bottom: 0; }
.toast-slot.toast-still, .toast-slot.toast-still .toast { transition: none; }

.toast {
  --toast-kind: var(--accent);
  position: relative; overflow: hidden; pointer-events: auto; cursor: default;
  display: flex; align-items: center; gap: 10px;
  width: 100%; box-sizing: border-box;
  padding: 10px 16px 10px 10px;
  background: var(--bg-tertiary); color: var(--text-normal);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.38), 0 2px 6px rgba(0, 0, 0, 0.28);   /* no outline: the user, round 2 */
  font-family: var(--font-sans); font-size: var(--fs-lg); font-weight: var(--fw-medium); line-height: 1.3;
  transition: transform 150ms var(--snap-ease, ease-out), opacity 120ms ease-out;
}
.toast:not(.toast-progress) { cursor: pointer; }
.toast-success { --toast-kind: var(--green); }
.toast-error { --toast-kind: var(--red, oklch(63.7% 0.208 25.3)); }
.toast-warning { --toast-kind: var(--yellow); }
.toast-info, .toast-progress { --toast-kind: var(--accent); }
.toast-spotify { --toast-kind: #1DB954; }   /* the Spotify account refused something: its own mark and green */
.toast-spotify .toast-icon { background: transparent; }
.toast-spotify .toast-glyph { width: 22px; height: 22px; }

/* In: swipes up into place as it fades in. Out: swipes on up as it fades. Straight up both ways, never diagonal. */
.toast-slot.entering .toast { opacity: 0; transform: translate3d(0, 14px, 0); }
.toast-slot.leaving .toast { opacity: 0; transform: translate3d(0, -12px, 0); transition-duration: 130ms; }
/* The same message again: a small nod so the repeat is seen */
.toast.toast-bump { animation: toast-bump 220ms var(--snap-ease, ease-out); }
@keyframes toast-bump { 40% { transform: scale(1.025); } }

.toast-icon {
  position: relative; flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--toast-kind);
  background: color-mix(in srgb, var(--toast-kind) 16%, transparent);
}
.toast-glyph { width: 16px; height: 16px; }
.toast-progress .toast-glyph { width: 18px; height: 18px; }
/* The ring: only on progress. A figure fills it; no figure, a short arc goes round. */
.toast-ring { position: absolute; inset: 0; width: 26px; height: 26px; transform: rotate(-90deg); display: none; }
.toast-progress .toast-ring { display: block; }
.toast-progress .toast-icon { background: transparent; }
.toast-ring circle { fill: none; stroke-width: 2; }
.toast-ring-track { stroke: color-mix(in srgb, var(--toast-kind) 22%, transparent); }
.toast-ring-arc { stroke: var(--toast-kind); stroke-linecap: round; transition: stroke-dashoffset 160ms ease-out; }
.toast-progress:not(.has-pct) .toast-ring-arc { stroke-dashoffset: 61.26; animation: toast-spin 0.9s linear infinite; transform-origin: 14px 14px; }
@keyframes toast-spin { to { transform: rotate(360deg); } }

.toast-text { min-width: 0; white-space: pre-line; overflow-wrap: anywhere; }
/* A thin bar along the bottom for a job with a figure */
.toast.has-pct::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: var(--toast-pct, 0%);
  background: var(--toast-kind); transition: width 160ms ease-out;
}

/* ========================================
   2. Segmented controls: one pill slides to the choice (renderer/seg-slide.js)
   The pill carries the active button's own look (copied from the page's CSS by the script) and sits under the
   buttons' text; the resting buttons' own shade moves to a ::before under the pill, so it passes over them.
   The doubled selectors outrank the controls' own ".x button.active" rules without !important.
   ======================================== */
[data-seg-ready] { isolation: isolate; }
[data-seg-ready][data-seg-pos] { position: relative; }
.seg-pill {
  position: absolute; left: 0; top: 0; z-index: -1; box-sizing: border-box; pointer-events: none;
  opacity: 0; border: 0;
  transition: transform 160ms var(--snap-ease, ease-out), width 160ms var(--snap-ease, ease-out), height 160ms var(--snap-ease, ease-out);
}
.seg-pill.placed { opacity: 1; }
[data-seg-ready][data-seg-ready] > .seg-item.seg-item {
  position: relative; z-index: auto; background: transparent; box-shadow: none;
  transition: color 120ms ease-out, opacity 120ms ease-out, border-color 120ms ease-out;
}
[data-seg-ready][data-seg-border] > .seg-item.seg-item:is(.active, .is-open, [aria-checked="true"], [aria-selected="true"]) { border-color: transparent; }
[data-seg-ready] > .seg-item::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background-color: var(--seg-rest-bg, transparent); background-image: var(--seg-rest-img, none); box-shadow: var(--seg-rest-shadow, none);
  transition: background-color 100ms ease-out;
}
/* A resting button still answers the pointer (its own :hover shade was cleared with its background) */
[data-seg-ready] > .seg-item:not(:disabled):hover::before {
  background-image: linear-gradient(var(--bg-modifier-hover), var(--bg-modifier-hover)), var(--seg-rest-img, none);
}
[data-seg-still], [data-seg-still] > * { transition: none !important; }

/* ========================================
   3. Music page: this PC's Spotify app (renderer/discord-spotify.js setupSpotifyPcApp)
   ======================================== */
/* The page icon turns into Spotify's mark while an account is connected: a quick pop, same colour as before */
.tab-header-icon-music.icon-swap { animation: music-icon-swap 200ms var(--snap-ease, ease-out); }
@keyframes music-icon-swap { from { transform: scale(0.7); opacity: 0.2; } }

.music-pc-app[hidden] { display: none; }
.music-pc-app .music-field-row #spotify-app-path {
  font-family: var(--font-sans); font-size: var(--fs-sm); font-weight: var(--fw-regular); color: var(--text-muted);
  text-overflow: ellipsis; cursor: default;
}

/* Confetti from a toast (keyboard-ui.js toastCelebrate): a fixed layer over everything, pieces moved by transforms */
.toast-confetti { position: fixed; inset: 0; z-index: 10003; pointer-events: none; overflow: hidden; }
.toast-confetti > i { position: absolute; width: 6px; height: 9px; border-radius: 1px; will-change: transform, opacity; }

/* ========================================
   4. The tooltip bubble (renderer/keyboard-ui.js): shown at once while "warm", and a red tint for destructive controls
   ======================================== */
.floating-tooltip.instant { transition: none; }
.floating-tooltip.danger {
  background: color-mix(in srgb, var(--red, oklch(63.7% 0.208 25.3)) 24%, var(--bg-tertiary));
  color: var(--text-normal);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
/* The title line in red, mixed toward the text colour so it reads at this 11 px size: 4.5:1 or more on the red-tinted
   bubble in all 16 themes (plain --red measured 2.1-4.5:1). Pink Pastel's bubble is light pink, so its red goes darker. */
.floating-tooltip.danger.titled::first-line { color: color-mix(in oklab, var(--red, oklch(63.7% 0.208 25.3)) 60%, var(--text-normal)); }
[data-theme="pink-pastel"] .floating-tooltip.danger.titled::first-line { color: color-mix(in oklab, var(--red, oklch(63.7% 0.208 25.3)) 35%, var(--text-normal)); }
.info-tooltip { cursor: pointer; }

/* ========================================
   5. Screen tab bits (Nova 1.35.0, round 2)
   ======================================== */
/* The Music page's Spotify mark in Spotify's own green (the user asked; brand colour, the same in every theme) */
.tab-header-icon-music.is-spotify { color: #1DB954; }

/* Storage: the figures' box has the Saved GIFs list's corner, and the bar inside it the corner minus the padding */
.storage-box { padding: 10px; background: var(--bg-tertiary); border-radius: var(--radius); margin-bottom: 12px; }
.storage-box .storage-bar { border-radius: max(2px, calc(var(--radius) - 10px)); }

/* Search + Refresh / Manage rows: one height, one corner, and the field without a border (shade only) */
.sd-gif-toolbar { align-items: center; }
.sd-gif-toolbar > .btn { height: 36px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; display: inline-flex; align-items: center; }
.sd-gif-toolbar .sd-gif-search { align-self: stretch; display: flex; }
.sd-gif-toolbar .sd-gif-search .key-search-input {
  height: 36px; box-sizing: border-box; padding-top: 0; padding-bottom: 0; margin-bottom: 0;
  border-radius: var(--radius); border-color: transparent; background: var(--field-sunk-bg, var(--bg-primary));
}
.sd-gif-toolbar .sd-gif-search .key-search-input:focus { border-color: transparent; background: var(--field-hover-bg, var(--bg-primary)); }
.sd-gif-toolbar .sd-gif-search .key-search-icon { top: 50%; transform: translateY(-50%); }

/* ========================================
   6. Music page, condensed (the user, round 3: "surely there's a way to condense, Strength has so much spacing")
   One rhythm: cards 16 px in, the title 8 px over its first row, rows 10 px top and bottom with a hairline between.
   ======================================== */
#panel-spotify .spotify-section { padding: 16px 18px; }
#panel-spotify .spotify-section-header { margin-bottom: 8px; }
#panel-spotify .spotify-pulse-row { padding: 10px 0; }
#panel-spotify .spotify-section-header + .spotify-pulse-row { padding-top: 4px; }
#panel-spotify .spotify-pulse-desc { margin-top: 2px; }
/* The note under "Strength" is part of its row now; empty, it takes no room */
#panel-spotify .spotify-pulse-text .spotify-pulse-note:not(:empty) { margin-top: 2px; }

/* Spotify account card: status, what it adds, then three clear rows split by hairlines:
   [connected with your app ... Disconnect] / [Play on this PC ... switch] / [Spotify app: path ... Browse] */
#panel-spotify .music-account-what { margin-bottom: 12px; }
#spotify-connected-section > .music-field-row { padding: 10px 0; border-top: 1px solid var(--bg-tertiary); }
#spotify-connected-section > .music-field-row .music-account-note { flex: 1; min-width: 0; }
.music-pc-app { margin-top: 0; }
.music-pc-app .spotify-pulse-row { border-top: 1px solid var(--bg-tertiary); padding: 10px 0; }
.music-pc-app .music-field-label { margin-top: 0; padding-top: 10px; border-top: 1px solid var(--bg-tertiary); }

/* ========================================
   7. Keyboard and touch (renderer/a11y.js, live-sort.js, quick-toggles.js; Nova 1.44.1)
   The controls that became Tab stops show a thin accent line only to someone moving with Tab (body.kb-nav, set by
   Tab and cleared by any pointer press: keys-editors.js), so nothing changes for the mouse.
   ======================================== */
.toggle-switch:focus, .info-tooltip:focus, .gif-slot-item:focus, .gradient-stop:focus, .qt-chooser-row:focus { outline: none; }
body.kb-nav .toggle-switch:focus-visible,
body.kb-nav .info-tooltip:focus-visible,
body.kb-nav .gif-slot-item:focus-visible,
body.kb-nav .gradient-stop:focus-visible,
body.kb-nav .qt-chooser-row:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
body.kb-nav .qt-chooser-row:focus-visible { outline-offset: -1px; }

/* Drag surfaces: a touch drags instead of scrolling the page. The GIF grid and the swatch rows keep vertical
   scrolling (a sideways start drags); the Quick Actions rows move up and down, so they take the whole gesture. */
.gif-slot-item.can-move, .gradient-stop { touch-action: pan-y; }
#quick-toggles-section > .control-row[data-qt], .qt-chooser-row { touch-action: none; }
/* The right-click menus a tile or swatch opens from the keyboard (a11y.js a11yMenuKey): the same accent line */
body.kb-nav .slot-context-menu button:focus-visible,
body.kb-nav .swatch-menu button:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }

/* ========================================
   7. Screen page in two sub-tabs (Nova 1.47, renderer/screen-subtabs.js): GIFs | Screen Settings
   The bar on top, then ONE scrolling area the full width of the page. The two old columns step aside
   (display: contents), so every part is a cell of one grid: the GIFs tab's rows span the width; Screen
   Settings is one block of three columns (GIF page | HUD | Notepad). Only the open tab's parts show.
   ======================================== */
/* (.panel.active already makes it a column flex box; the layout below takes the height left under the bar) */
.screen-subtab-bar {
  flex: none; display: flex; align-items: center; gap: 16px;
  margin-bottom: var(--page-gap); padding: 12px 16px;
  background: var(--bg-secondary); border-radius: var(--radius);
}
.screen-subtabs .screen-subtab { padding: 7px 16px; font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.screen-subtabs .screen-subtab[hidden] { display: none; }
#panel-screen .screen-two-column-layout {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--page-gap);
  align-content: start; align-items: start;
  overflow-y: auto; overflow-x: hidden; padding-right: 8px; min-height: 0;
}
#panel-screen .screen-left-column, #panel-screen .screen-right-column { display: contents; }
#panel-screen .screen-two-column-layout > * > [data-screen-page] { margin: 0; min-width: 0; }
#panel-screen [data-screen-page] { grid-column: 1 / -1; }
#panel-screen[data-screen-tab="gifs"] [data-screen-page]:not([data-screen-page="gifs"]),
#panel-screen[data-screen-tab="settings"] [data-screen-page]:not([data-screen-page="settings"]) { display: none !important; }

/* Screen Settings: three columns that each hold their own cards, so a tall card (HUD) never pushes a short one
   down. Column 1 is what the GIF page does (its look, what a swipe up shows), 2 the HUD bars, 3 the Notepad.
   Capped so the rows don't stretch on a wide window; two columns when narrow, the Notepad then under both. */
#panel-screen .screen-settings {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--page-gap);
  align-items: start; max-width: 1240px;
}
#panel-screen .screen-settings-col { display: flex; flex-direction: column; gap: var(--page-gap); min-width: 0; }
#panel-screen .screen-settings-col[hidden] { display: none; }
/* Dense and even (the user's rule): 16 px round every card, the md title, the quick-action rows as tight as the
   HUD's, so the tab fits a 1200 x 800 window without scrolling */
#panel-screen .screen-settings .gif-upload-section { padding: 16px; margin: 0; }
#panel-screen .screen-settings .gif-upload-title { font-size: var(--fs-md); margin-bottom: 12px; }
#panel-screen .screen-settings .hud-row-label { white-space: nowrap; }
#panel-screen .screen-settings .qa-preview { margin-bottom: 10px; }
#panel-screen .screen-settings .qa-slot { margin-bottom: 6px; }
#panel-screen .screen-settings .qa-slot:last-child { margin-bottom: 0; }
#panel-screen .screen-settings .qa-dropdown .dropdown-trigger { padding-top: 7px; padding-bottom: 7px; }
/* Hold Opens' two choices fit the column at 1200 px (they ran past the card edge) */
#panel-screen .screen-settings .spotify-pulse-level { padding: 5px 10px; }
@media (max-width: 1100px) {
  #panel-screen .screen-settings { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #panel-screen .screen-settings-col:last-child:not(:first-child) { grid-column: 1 / -1; max-width: calc(50% - var(--page-gap) / 2); }
}

/* Titles in the text colour on this page: accent is for the main buttons and the open tab (trial, the user judges) */
#panel-screen .gif-upload-title { color: var(--text-normal); }

/* The Default tile: a fixed width, and as tall as the search box and slot rows beside it, so it ends level with the
   last row (Nova 1.54.5, the user: two rows tall it stopped short of the grid's bottom and looked cut off) */
@container (min-width: 600px) {
  #panel-screen .gif-slots-grid { grid-template-columns: clamp(150px, 20%, 220px) minmax(0, 1fr); align-items: stretch; }
  /* and its picture as wide as the tile (it stopped at 128 px, small in the tall tile) */
  #panel-screen .slot-default .slot-preview { max-width: 100%; }
}

/* Screen Remote in Quick Actions (quick-toggles.js data-qt="remote"): the D-pad again (Nova 1.47, the user asked
   for the grid back). Its name on one line, then up, left, select, right, down in a 3 x 3 grid under it, centred
   (.remote-up etc. in styles.css place them), the round select in the middle. Same buttons and press look as the
   old pad, at the panel's 26 px control size. */
#quick-toggles-section > .qt-remote-row { flex-direction: column; align-items: stretch; gap: 6px; padding-top: 6px; padding-bottom: 8px; }
.qt-remote { display: grid; grid-template-columns: repeat(3, 26px); grid-template-rows: repeat(3, 26px); gap: 3px; justify-content: center; }
.qt-remote .remote-btn { width: 26px; height: 26px; border-radius: calc(var(--radius) - 2px);
  background: color-mix(in srgb, var(--text-normal) 7%, var(--bg-tertiary)); }   /* bg-tertiary alone vanished in Matrix */
.qt-remote .remote-btn:hover { background: var(--bg-modifier-hover); }
.qt-remote .remote-btn:active { background: var(--bg-tertiary); }   /* pressed in; the inset shadow is styles.css's */
.qt-remote .remote-btn svg { width: 14px; height: 14px; }
.qt-remote .remote-select { border-radius: 50%; }
.qt-remote .remote-select svg { width: 10px; height: 10px; }
