/* My shelf (/shelf/) and the "Keep on this device" block under a matching result on
   /transparency/check/. Loaded on those two pages only. Markup: src/shelf.mjs.
   The boxes themselves are drawn in the browser by src/shelf-client.js. */

/* ---- Keep on this device ------------------------------------------------ */
.shelf-keep { margin-top: 1rem; }
.shelf-keep .actions { align-items: center; gap: 0.25rem 1.25rem; }
.shelf-keep__status { margin: 0.6rem 0 0; color: var(--teal-ink); font-weight: 600; }
.shelf-keep__status:empty { margin: 0; }
.shelf-keep__note { max-width: 34rem; margin: 0.6rem 0 0; color: var(--ink-soft); font-size: 0.875rem; line-height: 1.55; }

/* ---- The shelf ---------------------------------------------------------- */
.shelf-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 0.5rem 2rem; }
.shelf-head h2 { margin-bottom: 0; }
.shelf-count { margin: 0; color: var(--ink-soft); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.shelf-promise { max-width: 46rem; margin: 1.1rem 0 0; padding: 0.85rem 1.1rem; border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; background: var(--surface-teal); color: var(--ink); font-size: 0.9rem; line-height: 1.6; }
.shelf-section .empty-state { margin-top: 2rem; }
.shelf-section .empty-state .actions { margin-top: 1.25rem; }

/* Boxes stand on a plank: the picture and name above it, the cards below it.
   On wide screens the boxes share a row, and subgrid keeps the plank level. */
.shelf { display: grid; grid-template-columns: minmax(0, 1fr); margin: 2rem 0 0; padding: 0; overflow-x: clip; list-style: none; }
.shelf-box { display: grid; grid-row: span 2; grid-template-rows: subgrid; min-width: 0; }
.shelf-box__stand { display: flex; align-items: flex-end; align-self: end; gap: 1rem; padding: 0 0.35rem; }
.shelf-box__front { display: grid; flex: 0 0 4.5rem; align-content: space-between; aspect-ratio: 3 / 4; padding: 0.5rem 0.55rem; border-radius: 0.3rem 0.3rem 0 0; color: var(--paper-bright); background: linear-gradient(165deg, #123D3A, var(--night) 70%); box-shadow: inset 0 0 0 1px rgb(217 199 160 / 0.4); }
.shelf-box__number { font-family: var(--font-display); font-size: 1.75rem; line-height: 1; font-variant-numeric: tabular-nums; overflow: hidden; }
.shelf-box__number[data-digits="some"] { font-size: 1.15rem; }
.shelf-box__number[data-digits="many"] { font-size: 0.8rem; overflow-wrap: anywhere; }
.shelf-box__marks { display: flex; flex-wrap: wrap; gap: 0.2rem; }
.shelf-box__marks i { width: 0.4rem; height: 0.4rem; border: 1px solid var(--brass); border-radius: 50%; }
.shelf-box__marks i[data-shown] { background: var(--brass); }
/* An example box is drawn in outline, so it never reads as a release at a glance. The Example tag says so in words. */
.shelf-box[data-example] .shelf-box__front { color: var(--ink); background: var(--paper-bright); box-shadow: inset 0 0 0 1px var(--line-strong); }
.shelf-box[data-example] .shelf-box__marks i { border-color: var(--teal-ink); }
.shelf-box[data-example] .shelf-box__marks i[data-shown] { background: var(--teal-ink); }
.shelf-box__name { min-width: 0; padding-bottom: 0.55rem; }
.shelf-box__tag { display: inline-block; margin: 0 0 0.45rem; padding: 0.12rem 0.55rem; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink); background: var(--lime); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.shelf-box__title { margin: 0; font-size: 1.6rem; line-height: 1.15; }
.shelf-box__release { margin: 0.3rem 0 0; overflow-wrap: anywhere; }
.shelf-box__body { position: relative; min-width: 0; padding: 0.7rem 0.35rem 2.25rem; border-top: 3px solid var(--brass); }
/* The plank runs on to the end of the shelf after the last box. */
.shelf-box:last-child .shelf-box__body::after { content: ""; position: absolute; top: -3px; left: 100%; width: 100vw; border-top: 3px solid var(--brass); }
.shelf-box__shown { margin: 0 0 0.4rem; color: var(--ink-soft); font-size: 0.9rem; }

.shelf-box__details summary { display: inline-flex; align-items: center; gap: 0.55rem; min-height: 44px; padding-right: 0.75rem; color: var(--teal-ink); font-size: 0.85rem; font-weight: 600; cursor: pointer; list-style: none; }
.shelf-box__details summary::-webkit-details-marker { display: none; }
.shelf-box__details summary::before { content: ""; flex: 0 0 auto; width: 0.45rem; height: 0.45rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-0.12rem) rotate(45deg); }
.shelf-box__details[open] summary::before { transform: translateY(0.12rem) rotate(-135deg); }
.shelf-cards { margin: 0.25rem 0 1.1rem; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.shelf-card { display: grid; grid-template-columns: 4.4rem minmax(0, 1fr); gap: 0 0.75rem; align-items: baseline; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.shelf-card .mono-label { margin: 0; }
.shelf-card__name { overflow-wrap: anywhere; }
.shelf-card__id { color: var(--muted); font-size: 0.85em; }
.shelf-card[data-shown="false"] .shelf-card__name { color: var(--muted); }
.shelf-card__again { display: inline-flex; grid-column: 2; align-items: center; min-height: 44px; color: var(--teal-ink); font-size: 0.85rem; font-weight: 600; }
.shelf-box__facts { display: grid; gap: 0.8rem; margin: 0 0 0.9rem; }
.shelf-box__facts dt { color: var(--ink-soft); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; }
.shelf-box__facts dd { margin: 0.2rem 0 0; }
.shelf-box__facts code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8rem; overflow-wrap: anywhere; }
.shelf-box__note { margin: 0 0 0.5rem; color: var(--ink-soft); font-size: 0.875rem; }
.shelf-box__actions { align-items: center; gap: 0 1.5rem; }
.shelf-box__actions .shelf-box__remove { color: var(--danger, #9b2c2c); cursor: pointer; }

/* Focus lands on Undo after a change and on the heading after Undo: keep both clear of the sticky header, as .seal-result does. */
.shelf-section :is(h2, a, button, summary, .shelf-undo), .shelf-keep :is(a, button) { scroll-margin-top: 7rem; scroll-margin-bottom: 1rem; }
.shelf-undo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; max-width: 46rem; margin-top: 1.5rem; padding: 0.9rem 1.1rem; border: 1px solid #a4bdb0; border-radius: var(--radius); background: var(--surface-teal); }
.shelf-undo p { margin: 0; }
.shelf-status { margin: 1rem 0 0; color: var(--teal-ink); font-weight: 600; }
.shelf-status:empty { margin: 0; }
.shelf-tools { margin-top: 1.5rem; }
.shelf-facts { margin: 0 0 1.25rem; padding-left: 1.1rem; }
.shelf-facts li + li { margin-top: 0.5rem; }

@media (min-width: 48rem) {
  .shelf { grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
  .shelf-box__stand { padding-top: 1rem; }
  .shelf-box__front { flex-basis: 5.5rem; }
  .shelf-box__number:not([data-digits]) { font-size: 2.1rem; }
  .shelf-box__body { padding-right: 1.5rem; }
}

@media (forced-colors: active) {
  .shelf-box__front { border: 1px solid CanvasText; }
  .shelf-box__marks i { border-color: CanvasText; }
  .shelf-box__marks i[data-shown] { background: CanvasText; forced-color-adjust: none; }
  .shelf-box__body, .shelf-box:last-child .shelf-box__body::after { border-top-color: CanvasText; }
}
