/* Vanta Supply · saving pieces to "Your vault" (members only), 2026-10-24 concept.
   Shared by home-member.html, saved.html and, through viewer-save.js, the collection pages:
   the nav button with its count, the bookmark on a tile, the button in the piece viewer, and the note. */

.mh-navvault { margin-left: 4px; }
.mh-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; margin-right: -8px;
  border-radius: 999px; font-size: 12.5px; background: var(--bg); color: var(--ink); font-variant-numeric: tabular-nums;
}

.mh-count[hidden], .mh-count:empty { display: none; } /* empty until saves.js counts: no blank pill that then vanishes */
.mh-navvault .mh-count { margin-right: -6px; height: 20px; min-width: 20px; font-size: 12px; }
.mh-navvault[aria-current] { box-shadow: 0 0 0 1px var(--ink); }

/* ---- a tile you can save: the whole tile opens the piece, the bookmark sits above it ---- */
.svtile__hit { position: absolute; inset: 0; z-index: 3; border-radius: inherit; }
.svtile__hit:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.save {
  position: absolute; z-index: 4; top: 10px; right: 10px;
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(12, 10, 9, 0.55); color: var(--ink);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; transform: scale(0.9);
  transition: opacity .2s ease-out, transform .25s var(--ease), background-color .2s ease-out;
}
.save::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; } /* 44px to tap */
.save__i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; transition: fill .2s ease-out; }
.save:hover { background: rgba(12, 10, 9, 0.8); }
.save:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; opacity: 1; transform: none; }
.tile:hover .save, .tile:focus-within .save, .save[aria-pressed="true"] { opacity: 1; transform: none; }
.save[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.save[aria-pressed="true"] .save__i { fill: currentColor; }
.save.is-pop { animation: save-pop .45s var(--ease); }
@keyframes save-pop { 0% { transform: scale(0.8); } 55% { transform: scale(1.12); } 100% { transform: scale(1); } }
/* touch screens have no hover: the bookmark is always there */
@media (hover: none) { .save { opacity: 1; transform: none; } }
/* only members can save */
html:not([data-as="member"]) .save { display: none; }

/* ---- the note at the foot of the screen ---- */
.svt {
  position: fixed; z-index: 40; left: 50%; bottom: 24px; transform: translate(-50%, 16px);
  display: flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 6px 0 18px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-size: 14.5px; white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  opacity: 0; pointer-events: none; transition: opacity .2s ease-out, transform .35s var(--ease);
}
.svt:not(:has(.svt__a)) { padding-right: 18px; }
.svt.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.svt__a { min-height: 34px; padding: 0 12px; margin-left: 6px; border-radius: 999px; font-weight: 600; color: var(--bg); background: rgba(12, 10, 9, 0.08); }
.svt__a:hover { background: rgba(12, 10, 9, 0.16); }

/* the phone header keeps "Your vault" beside the menu button */
@media (max-width: 640px) {
  html[data-as="member"] .nav__right .btn.mh-navvault { display: inline-flex !important; min-height: 40px; padding: 0 12px 0 14px; margin-right: 6px; font-size: 13.5px; }
}

/* ---- in the piece viewer: Save in the action area ---- */
/* a code piece: Save is the main button, in Copy code's place, right under the controls */
.side__savebtn .save__i { width: 16px; height: 16px; }
.side__savebtn[aria-pressed="true"] { background: var(--fill); color: var(--ink); }
.side__savebtn[aria-pressed="true"]:hover { background: var(--fill-hover); }
.side__savebtn[aria-pressed="true"] .save__i { fill: currentColor; }
.side__savebtn.is-pop .save__i { animation: save-pop .45s var(--ease); }
/* an image or video: beside Download, on the same line */
.side__actions:has(> .side__savebtn--beside) { grid-template-columns: minmax(0, 1fr) auto; }
.side__actions:has(> .side__savebtn--beside) > :not(.btn--dl):not(.side__savebtn--beside) { grid-column: 1 / -1; }
.side__savebtn--beside { padding: 0 18px 0 16px; box-shadow: inset 0 0 0 1px rgba(243, 238, 231, 0.16); background: transparent; }
.side__savebtn--beside:hover { background: var(--fill); }
.side__savebtn--beside[aria-pressed="true"] { box-shadow: none; }
html:not([data-as="member"]) .side__savebtn { display: none; }
/* the tag on a saved piece that kept its settings */
.tag--tuned { padding: 0 9px; border-radius: 999px; background: rgba(12, 10, 9, 0.6); color: var(--ink); }
dialog .svt { position: fixed; }

@media (max-width: 640px) {
  .svt { bottom: max(16px, env(safe-area-inset-bottom)); font-size: 14px; }
  .save { top: 8px; right: 8px; width: 34px; height: 34px; }
}

/* beside Save there is no room for the file size on Download; it is listed in the File details just above */
.side__actions:has(> .side__savebtn--beside) .btn--dl .btn__n { display: none; }
.side__actions:has(> .side__savebtn--beside) .btn--dl { padding: 0 16px; min-width: 0; }
.side__actions:has(> .side__savebtn--beside) .btn--dl .lbl { overflow: hidden; text-overflow: ellipsis; }
/* the same width saved or not, so Download never shifts when you press it */
.side__savebtn--beside { min-width: 100px; padding: 0 14px; }

/* ---- Your vault: a piece's viewer laid over the page (saves.js openOver). The dim comes up at once;
   the viewer fades in on top of it when it is ready (Dan, 2026-10-25) ---- */
.svx {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(5, 4, 3, 0.88);
  opacity: 0; transition: opacity .18s ease-out;
}
.svx.is-on { opacity: 1; transition: opacity .26s ease-out; }
.svx__frame {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
  background: transparent; color-scheme: dark;
  opacity: 0; transition: opacity .2s ease-out;
}
.svx.is-ready .svx__frame { opacity: 1; }
/* a quiet ring, only if the viewer takes more than a moment */
.svx__wait {
  position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border-radius: 50%; border: 2px solid rgba(243, 238, 231, 0.18); border-top-color: rgba(243, 238, 231, 0.75);
  opacity: 0; animation: svx-spin .9s linear infinite, svx-late .2s ease-out .5s forwards;
}
.svx.is-ready .svx__wait { display: none; }
@keyframes svx-spin { to { transform: rotate(360deg); } }
@keyframes svx-late { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .svx__wait { animation: svx-late .2s ease-out .5s forwards; } }
html.svx-lock, html.svx-lock body { overflow: hidden; }
