/* Pal · Pins and Your wall. Monochrome like the rest of Pal: a pinned pin is filled with the text colour. */
:root { --saved-color: var(--color-text); }

[aria-pressed="true"] > .icon-pin { fill: currentColor; }
.icon-pin path:last-child { fill: none; }                      /* the needle is a line */

/* ---- Field: the pin closes the capsule, right after your path ---- */
.cap-save { margin-left: 2px; }
.cap-save[aria-pressed="true"] { color: var(--saved-color); }

/* A pinned step on the path has a pin pushed into its top edge, like a print pinned up. */
#explore-dialog .path-thumb { position: relative; }
#explore-dialog .path-thumb.is-saved::after {
  content: ""; position: absolute; left: 50%; top: 0; width: 15px; height: 15px; transform: translateX(-50%);
  background: var(--saved-color); filter: drop-shadow(0 0 1px var(--color-canvas));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg transform='rotate(28 12 12)'%3E%3Cpath d='M9.6 3.2h4.8l-.7 5.4 3.1 3.3v1.7H7.2v-1.7l3.1-3.3z'/%3E%3Cpath d='M11.3 13.6h1.4v7.2h-1.4z'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg transform='rotate(28 12 12)'%3E%3Cpath d='M9.6 3.2h4.8l-.7 5.4 3.1 3.3v1.7H7.2v-1.7l3.1-3.3z'/%3E%3Cpath d='M11.3 13.6h1.4v7.2h-1.4z'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
#explore-dialog .path-thumb.is-dropping::after { opacity: 0; }
.pin-drop { position: fixed; z-index: 1000; display: block; color: var(--saved-color); pointer-events: none; transform-origin: 50% 90%; }
.pin-drop .icon { width: 100%; height: 100%; fill: currentColor; stroke-width: 1.6; filter: drop-shadow(0 2px 2px rgb(0 0 0 / 20%)); }

/* A related work you pinned earlier is recognisable when it comes round again. The mark sits just
   above the work: nothing is drawn on the artwork, and the work in focus has the capsule pin instead. */
.f-saved-mark {
  position: absolute; right: 50%; bottom: 100%; margin-bottom: 4px; display: block; width: 15px; height: 15px;
  transform: translateX(50%); color: var(--saved-color); pointer-events: none;
}
.f-saved-mark .icon { width: 15px; height: 15px; fill: currentColor; stroke-width: 1.5; }
.f-tile.is-focus .f-saved-mark { display: none; }

/* ---- Wall buttons: Field toolbar (right) and collection header ---- */
.saved-pill, .saved-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--glass-border); border-radius: 24px; background: var(--glass-bg);
  color: var(--color-text); font: 400 var(--text-subheadline)/1 var(--font-ui); cursor: pointer;
  -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
}
#explore-dialog .field-toolbar .saved-pill { margin-left: auto; padding: 0 14px; }
.saved-pill .icon, .saved-link .icon { width: 16px; height: 16px; }
.saved-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center;
  background: var(--color-action); color: var(--color-on-action); font: 600 11px/1 var(--font-ui); font-variant-numeric: tabular-nums;
}
@media (hover: hover) { .saved-pill:hover, .saved-link:hover { background: var(--color-fill); } }
.collection-header .account-links { align-items: center; }
.saved-link { min-height: 40px; padding: 0 14px; font-size: .875rem; background: transparent; }

/* ---- Collection grid: a pin on each card, shown on hover or keyboard focus ---- */
.card-wrap { position: relative; }
.card-save {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--glass-border); border-radius: 50%;
  background: var(--glass-bg); color: var(--color-text); cursor: pointer;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  opacity: 0; transition: opacity var(--duration-quick) var(--ease-standard), transform var(--duration-quick) var(--ease-standard);
}
.card-save::after { content: ""; position: absolute; inset: -4px; }    /* 44pt target */
.card-save .icon { width: 18px; height: 18px; }
.card-save[aria-pressed="true"] { color: var(--saved-color); }
.card-save.is-fresh { opacity: 1; }          /* a new pin stays in view for 3 s, then shows on hover like the rest */
.card-wrap:hover .card-save, .card-wrap:has(:focus-visible) .card-save { opacity: 1; }   /* keyboard focus, not a lingering click */
@media (hover: hover) and (pointer: fine) and (min-width: 744px) {
  .card-wrap:hover .card-save { transform: translateY(-2px); }   /* rides with the card's hover lift */
}
@media (hover: none) {
  .card-save { opacity: .85; width: 32px; height: 32px; top: 6px; right: 6px; }   /* touch: always reachable */
  .card-save .icon { width: 16px; height: 16px; }
}

/* ---- Your wall: a side sheet on wide screens, a bottom sheet on phones ---- */
.saved-tray {
  position: fixed; inset: 0 0 0 auto; width: min(420px, 100vw); height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; border-left: 1px solid var(--color-separator); background: var(--color-canvas); color: var(--color-text);
  box-shadow: -12px 0 40px rgb(0 0 0 / 10%); overflow: hidden;
}
.saved-tray[open] { display: flex; flex-direction: column; animation: tray-in var(--duration-standard) var(--ease-standard); }
.saved-tray::backdrop { background: rgb(0 0 0 / 18%); }
@keyframes tray-in { from { transform: translateX(24px); opacity: 0; } }
.tray-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(16px, env(safe-area-inset-top)) 16px 8px 24px; }
.tray-head h2 { flex: 1; min-width: 0; margin: 0; font: 400 var(--text-title2)/1.2 var(--font-display); letter-spacing: -.01em; }
.tray-head h2 .icon { display: inline-block; width: 20px; height: 20px; margin-right: 8px; vertical-align: -2px; }
.tray-head .sheet-grabber { display: none; }
.tray-views { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--color-fill); }
.tray-views button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--color-text-secondary); font: 500 var(--text-caption1)/1 var(--font-ui); cursor: pointer; }
.tray-views button[aria-pressed="true"] { background: var(--color-canvas); color: var(--color-text); box-shadow: 0 1px 2px rgb(0 0 0 / 10%); }
.tray-close { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--color-text); cursor: pointer; }
@media (hover: hover) { .tray-close:hover { background: var(--color-fill); } }
.tray-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 12px max(24px, env(safe-area-inset-bottom)); }
.tray-group { padding: 12px 0 8px; }
.tray-group + .tray-group { border-top: 1px solid var(--color-separator); }
.tray-group-head { padding: 4px 12px 8px; }
.tray-group-head h3 { margin: 0; font: 500 var(--text-subheadline)/1.35 var(--font-ui); }
.tray-group-head cite { font: italic 400 1em/1 var(--font-display); }
.tray-group-meta { margin: 2px 0 0; color: var(--color-text-secondary); font-size: var(--text-caption1); }

/* The route: every step of the exploration on a hairline, pinned steps raised. */
.tray-route {
  display: flex; align-items: flex-end; gap: 3px; margin: 0 12px 10px; padding: 14px 2px 4px; list-style: none;
  overflow-x: auto; scrollbar-width: none;
  background: linear-gradient(var(--color-separator), var(--color-separator)) 0 calc(100% - 15px) / 100% 1px no-repeat;
}
.tray-route::-webkit-scrollbar { display: none; }
.tray-route li { position: relative; flex: none; display: grid; place-items: center; width: 22px; height: 22px; opacity: .45; }
.tray-route li img { max-width: 22px; max-height: 22px; display: block; }
.tray-route li.is-saved { opacity: 1; width: 28px; height: 28px; }
.tray-route li.is-saved img { max-width: 28px; max-height: 28px; }
.route-mark { position: absolute; left: 50%; top: -12px; width: 12px; height: 12px; transform: translateX(-50%); color: var(--saved-color); }
.route-mark .icon { width: 12px; height: 12px; fill: currentColor; stroke-width: 1.6; }

/* Wall view: a salon hang on a soft wall, in path order. */
.wall-hang {
  list-style: none; margin: 0 4px; padding: 26px 14px 22px;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 26px 18px;
  border-radius: 16px; background: var(--color-surface);
}
.wall-piece { position: relative; }
.wall-open {
  position: relative; display: grid; place-items: center; width: var(--w); height: var(--h); padding: 5px;
  border: 1px solid var(--color-separator); border-radius: 2px; background: var(--color-canvas);
  box-shadow: 0 2px 6px rgb(0 0 0 / 8%); transform: rotate(var(--tilt, 0deg)); cursor: pointer;
  transition: transform var(--duration-quick) var(--ease-standard), box-shadow var(--duration-quick) var(--ease-standard);
}
.wall-open img { width: 100%; height: 100%; object-fit: contain; display: block; }
@media (hover: hover) { .wall-open:not(:disabled):hover { transform: rotate(0) translateY(-2px); box-shadow: 0 6px 14px rgb(0 0 0 / 12%); } }
.wall-open[aria-current] { outline: 2px solid var(--color-text); outline-offset: 3px; cursor: default; }
.wall-pin { position: absolute; left: 50%; top: -11px; width: 18px; height: 18px; transform: translateX(-50%); color: var(--saved-color); pointer-events: none; }
.wall-pin .icon { width: 18px; height: 18px; fill: currentColor; stroke-width: 1.5; filter: drop-shadow(0 1px 1px rgb(0 0 0 / 20%)); }
.wall-unsave {
  position: absolute; top: -12px; right: -12px; display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 1px solid var(--glass-border); border-radius: 50%; background: var(--color-canvas); color: var(--saved-color);
  box-shadow: 0 1px 4px rgb(0 0 0 / 14%); cursor: pointer; opacity: 0; transition: opacity var(--duration-quick) linear;
}
.wall-unsave .icon { width: 15px; height: 15px; }
.wall-piece:hover .wall-unsave, .wall-piece:focus-within .wall-unsave { opacity: 1; }
@media (hover: none) { .wall-unsave { display: none; } }   /* touch: unpin from the Field or the List view */

/* List view */
.tray-list { list-style: none; margin: 0; padding: 0; }
.tray-item { display: flex; align-items: center; gap: 4px; border-radius: 14px; }
.tray-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 8px 12px; border: 0; border-radius: 14px;
  background: transparent; color: inherit; text-align: left; cursor: pointer; font: inherit;
}
@media (hover: hover) { .tray-open:not(:disabled):hover { background: var(--color-surface); } }
.tray-open[aria-current] { cursor: default; background: var(--color-surface); }
.tray-frame { flex: none; display: grid; place-items: center; width: 64px; height: 64px; }
.tray-frame img { max-width: 64px; max-height: 64px; display: block; }
.tray-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tray-title { font: 400 var(--text-callout)/1.3 var(--font-display); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tray-artist { font-size: var(--text-footnote); color: var(--color-text-secondary); }
.tray-found { font-size: var(--text-caption1); color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray-price { font-size: var(--text-footnote); font-variant-numeric: tabular-nums; }
.tray-actions { flex: none; display: flex; align-items: center; }
.tray-seller, .tray-unsave { display: grid; place-items: center; width: 40px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--color-text-secondary); cursor: pointer; }
.tray-unsave { color: var(--saved-color); }
.tray-seller .icon, .tray-unsave .icon { width: 18px; height: 18px; }
@media (hover: hover) { .tray-seller:hover, .tray-unsave:hover { background: var(--color-fill); color: var(--color-text); } }

.tray-empty { padding: 48px 24px; text-align: center; color: var(--color-text); }
.tray-empty p { margin: 8px 0 0; }
.tray-empty .muted { color: var(--color-text-secondary); font-size: var(--text-subheadline); line-height: 1.45; max-width: 30ch; margin-inline: auto; }
.tray-empty-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--color-surface); color: var(--color-text-secondary); }
.tray-empty-icon .icon { width: 24px; height: 24px; }

@media (max-width: 743.98px) {
  .saved-tray { inset: auto 0 0 0; width: 100%; height: min(78dvh, 640px); border: 0; border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; box-shadow: 0 -8px 32px rgb(0 0 0 / 12%); }
  @keyframes tray-in { from { transform: translateY(32px); opacity: 0; } }
  .tray-head { flex-wrap: wrap; padding-top: 8px; }
  .tray-head .sheet-grabber { display: block; flex-basis: 100%; height: 5px; width: 36px; max-width: 36px; margin: 0 auto 4px; border-radius: 3px; background: var(--color-separator); }
  #explore-dialog .field-toolbar .saved-pill .saved-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}

/* ---- Flight and toast ---- */
.saved-ghost { position: fixed; z-index: 1000; margin: 0; object-fit: contain; pointer-events: none; transform-origin: center; }
.saved-toast {
  position: fixed; inset: auto auto max(24px, env(safe-area-inset-bottom)) 50%; transform: translateX(-50%); margin: 0;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); padding: 10px 10px 10px 18px;
  border: 0; border-radius: 24px; background: var(--color-action); color: var(--color-on-action);
  font: 400 var(--text-subheadline)/1.35 var(--font-ui); box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
}
.saved-toast:not(:popover-open) { display: none; }   /* keep the browser's closed-popover rule */
.saved-toast:popover-open { animation: toast-in var(--duration-standard) var(--ease-standard); }
.saved-toast.in-field { top: calc(var(--field-bar, 56px) + 8px); bottom: auto; }   /* under the toolbar, clear of the caption */
.saved-toast button {
  flex: none; min-height: 36px; padding: 0 14px; border: 0; border-radius: 18px;
  background: rgb(255 255 255 / 16%); color: inherit; font: 500 var(--text-subheadline)/1 var(--font-ui); cursor: pointer;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (prefers-reduced-motion: reduce) {
  .saved-tray[open], .saved-toast:popover-open { animation: none; }
  .card-save, .card-wrap:hover .card-save { transition: opacity var(--duration-quick) linear; transform: none; }
  .wall-open, .wall-open:not(:disabled):hover { transition: none; }
}
@media (forced-colors: active) {
  #explore-dialog .path-thumb.is-saved::after { background: CanvasText; }
}
