/* ============================================
   Home views: shelf frames, shelf pages and the Map (js/home-views.js)
   Without JS none of this shows and the shelves render in full, as before.
   ============================================ */

.home-views { display: none; padding: 4px 0 56px; }
.js .home-views { display: block; }
.js .shelves > .shelf { display: none; }
.js body.is-shelf .shelves > .shelf.is-current { display: block; }
body.is-shelf .hero,
body.is-shelf .spotlight,
body.is-shelf .home-views { display: none; }
.js body.is-shelf .shelf.is-current { padding-top: 28px; }

/* ── Shelves / Map switch ── */
.view-switch {
  display: flex;
  width: max-content;
  margin: 0 auto 24px;
  padding: 3px;
  border-radius: 100px;
  background: #ececee;
}
.view-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 7px 20px;
  border-radius: 100px;
  font: 600 0.9375rem/1.2 var(--font-stack);
  color: var(--color-text-secondary);
  cursor: pointer;
}
.view-switch button[aria-pressed="true"] {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow);
}
.view-switch button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ── Frames: one per shelf; the frame opens the shelf, each picture opens its project ── */
.frames {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.frames[hidden], .treemap[hidden] { display: none; }
.frame {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 18px;
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--hue, var(--color-border));
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}
.frame:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.frame__head { display: flex; align-items: center; gap: 8px; }
.frame__title { font-size: 1.25rem; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.frame__open { color: var(--color-text); }
.frame__open:hover { color: var(--color-text); text-decoration: none; }
.frame__open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.frame__open:focus-visible { outline: none; }
.frame__open:focus-visible::after { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.frame__count {
  padding: 1px 9px;
  border-radius: 100px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
}
.frame__go {
  margin-left: auto;
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s, transform 0.15s;
}
.frame:hover .frame__go { color: var(--color-accent); transform: translateX(2px); }
.frame__blurb {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  line-height: 1.45;
}
.frame__vols,
.vol-strip {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 12px 10px;
  margin-top: auto;
  padding: 12px;
  border-radius: 8px;
  background: #f2f1ed;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.08);
}
.frame__vols { flex: 1; align-content: start; margin-top: 6px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.vol-strip { margin: 4px 0 18px; }

/* one volume: a small hero picture and its name */
.vol { position: relative; z-index: 1; display: block; color: var(--color-text); text-decoration: none; }
.vol:hover { color: var(--color-accent); text-decoration: none; }
.vol:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; border-radius: 6px; }
.vol-pic {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 5px;
  background: #d9d6cc;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.18s, box-shadow 0.18s;
}
.vol:hover .vol-pic { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22); }
.vol-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.vol-pic.is-icon { background: #fff; }
.vol-pic.is-icon img { object-fit: contain; padding: 6px; }
.vol-pic--mosaic { display: grid; grid-template: 1fr 1fr / 1fr 1fr; gap: 1px; background: #fff; }
.vol-pic--mosaic img { min-height: 0; }
.vol-pic__count {
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 1px 7px;
  border-radius: 100px;
  background: rgba(20, 20, 22, 0.78);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.5;
}
.vol--more .vol-pic {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 1.125rem;
  font-weight: 600;
}
.vol__name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.3;
}

/* ── Shelf pages ── */
/* a collection card takes the whole row; the cards around it backfill the gaps */
.project-grid:has(.project-card--collection) { grid-auto-flow: dense; }
.vol-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.shelf__back { display: none; }
.js .shelf__back {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 0.9375rem;
  font-weight: 500;
}

/* ── The Map: wider than the text column, up to 1200px, centred on the page ── */
.treemap {
  position: relative;
  width: min(1200px, calc(100vw - 48px));
  margin-left: calc(50% - min(600px, 50vw - 24px));
}
.tm-canvas {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: #1d1d1f;
  box-shadow: var(--shadow);
}
.tm-group { position: absolute; overflow: hidden; }
.tm-group--shelf { border-radius: 6px; background: var(--hue); }
.tm-group--coll { border-radius: 4px; background: rgba(0, 0, 0, 0.28); }
.tm-band {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  overflow: hidden;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tm-group--coll > .tm-band { font-size: 0.6875rem; font-weight: 600; padding: 0 6px; }
.tm-band:hover { color: #fff; text-decoration: underline; }
.tm-band__n { opacity: 0.72; font-weight: 500; }
.tm-leaf {
  position: absolute;
  display: block;
  overflow: hidden;
  border-radius: 3px;
  background: #2c2c2e;
}
.tm-leaf img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s; }
.tm-leaf:hover img { transform: scale(1.06); }
.tm-leaf.is-icon { background: #fff; }
.tm-leaf.is-icon img { object-fit: contain; padding: 10%; }
.tm-leaf:focus-visible { outline: 3px solid #ffb000; outline-offset: -3px; z-index: 2; }
.tm-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  padding: 16px 7px 5px;
  background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.25;
}
.tm-leaf.has-label .tm-label {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.map-note {
  margin-top: 10px;
  color: var(--color-text-secondary);
  font-size: 0.8125rem;
  text-align: center;
}

/* ── Tooltip shared by frames and the Map ── */
.hv-tip {
  position: fixed;
  z-index: 1000;
  width: 300px;
  max-width: calc(100vw - 24px);
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
  pointer-events: none;
}
.hv-tip[hidden] { display: none; }
.hv-tip.is-touch { pointer-events: auto; }
.hv-tip__img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #eceae4; }
.hv-tip__img[hidden] { display: none; }
.hv-tip__img.is-icon { object-fit: contain; padding: 12px; background: #fff; }
.hv-tip__body { padding: 10px 13px 12px; }
.hv-tip__where {
  color: var(--color-text-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hv-tip__title { margin: 2px 0 3px; font-size: 0.9375rem; font-weight: 600; line-height: 1.3; }
.hv-tip__stamp { color: var(--color-text-secondary); font-size: 0.75rem; line-height: 1.4; }
.hv-tip__stamp:empty { display: none; }
.hv-tip__desc {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 6px;
  font-size: 0.8125rem;
  line-height: 1.45;
}
.hv-tip__desc:empty { display: none; }
.hv-tip__foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.hv-tip__foot .badge[hidden] { display: none; }
.hv-tip__open { display: none; margin-left: auto; font-size: 0.875rem; font-weight: 600; }
.hv-tip.is-touch .hv-tip__open { display: inline; }

@media (max-width: 720px) {
  .frames { grid-template-columns: 1fr; gap: 16px; }
  .frame { padding: 16px 14px 14px; }
  .frame__vols, .vol-strip { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); padding: 10px; }
}
