/* Atlas chrome — the map page. Square corners everywhere; the only diagonal
   is the 12° cut. Canvas owns the middle; chrome floats in paper and ink. */

html, body { height: 100%; }
body {
  overflow: hidden; display: flex; flex-direction: column;
  /* the map owns the visible viewport, URL bar included: dvh tracks it */
  height: 100vh; height: 100dvh;
}
#app { display: flex; flex: 1; min-height: 0; }
#mapwrap { flex: 1; position: relative; min-width: 0; }
canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab;
  /* the map handles its own pan and pinch; the browser gets neither */
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
canvas.dragging { cursor: grabbing; }

/* ---- floating toolbar ---- */
#topbar {
  position: absolute; top: 12px; left: 12px; right: 12px; z-index: 5;
  display: flex; gap: 8px; align-items: center; pointer-events: none; flex-wrap: wrap;
}
#topbar > * { pointer-events: auto; }
#searchwrap { position: relative; flex: 1 1 240px; max-width: 360px; }
#search {
  /* 16px floor: below it iOS zooms in on focus and never zooms back */
  width: 100%; padding: 8px 12px; font: inherit; font-size: 1rem;
  color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--ink); outline: none;
}
#search::placeholder { color: var(--ink-soft); }
#search:focus { box-shadow: 3px 3px 0 var(--peri); }
#hits {
  position: absolute; top: calc(100% + 4px); left: 0; width: min(420px, 92vw);
  max-height: min(440px, 50dvh); overflow: auto;
  background: var(--paper); border: 1.5px solid var(--ink);
  box-shadow: 5px 5px 0 var(--peri);
  display: none; z-index: 6; padding-bottom: 4px;
}
#hits .ghead {
  font-size: var(--text-tag); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-soft); padding: 10px 12px 3px;
}
#hits .hit { padding: 5px 12px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
#hits .hit.kb, #hits .hit:active { background: var(--peri); }
@media (hover: hover) {
  #hits .hit:hover { background: var(--peri); }
}
#hits .k { font-size: var(--text--1); color: var(--ink-soft); margin-left: auto; text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
#hits .snip { font-size: var(--text--1); color: var(--ink-soft); padding: 0 12px 6px; line-height: 1.4; }
#hits .none { padding: 10px 12px; color: var(--ink-soft); font-size: var(--text--1); }
#hits .none a { color: var(--link); }
.tbtn {
  background: var(--paper); border: 1.5px solid var(--ink); color: var(--ink);
  padding: 8px 12px; cursor: pointer; font: inherit; font-size: 0.875rem;
  font-weight: 500; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
@media (hover: hover) {
  .tbtn:hover { background: var(--ink); color: var(--paper); }
}
.tbtn:active { background: var(--ink); color: var(--paper); }
.tbtn.active { background: var(--ink); color: var(--paper); }
/* the short labels and the filter button belong to narrow screens */
.tbtn-short { display: none; }
#filterbtn { display: none; }

/* ---- reset: the touch stand-in for double-click-to-fit ---- */
#resetbtn {
  position: absolute; z-index: 4; display: none;
  right: max(10px, env(safe-area-inset-right));
  bottom: calc(10px + env(safe-area-inset-bottom));
  align-items: center; justify-content: center;
  min-width: var(--tap); min-height: var(--tap); padding: 0;
}
#resetbtn svg { display: block; }
@media (max-width: 760px), (pointer: coarse) {
  #resetbtn { display: flex; }
}
body.sheet-open #resetbtn { display: none; }

/* ---- you are here: the rank ladder, bottom left ---- */
#crumb {
  position: absolute; bottom: 12px; left: 12px; z-index: 4;
  background: var(--peri); color: var(--ink);
  padding: 10px 16px calc(10px + 0.7rem) 14px;
  --cut: 0.7rem;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut) / 0.21256) 100%, 0 100%);
  max-width: min(380px, 60vw);
}
#crumb[hidden] { display: none; }
#crumb .crow { display: flex; align-items: baseline; gap: 10px; padding: 1px 0; }
#crumb .rk {
  width: 3.4rem; flex: none;
  font-size: var(--text-tag); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-soft);
}
#crumb button {
  background: none; border: none; font-family: var(--font-display);
  font-weight: 600; font-size: 0.98rem; line-height: 1.3;
  color: var(--ink); cursor: pointer; padding: 0; text-align: left;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (hover: hover) {
  #crumb button:hover { text-decoration: underline; text-underline-offset: 3px; }
}

/* ---- legend: docked at the right end of the toolbar row ---- */
#legend {
  margin-left: auto;
  background: var(--paper); border: 1px solid var(--line);
  padding: 7px 12px; font-size: var(--text--1); color: var(--ink-soft);
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
/* narrow screens: the legend folds into a popover behind the Filter button,
   so the kind filter stays reachable on every device */
@media (max-width: 900px) {
  #filterbtn { display: block; }
  #legend {
    display: none;
    position: absolute; top: calc(100% + 6px); right: 0; margin-left: 0;
    flex-direction: column; align-items: flex-start; gap: 8px;
    background: var(--paper); border: 1.5px solid var(--ink);
    box-shadow: 5px 5px 0 var(--peri);
    padding: 12px 14px; z-index: 6;
  }
  #legend.open { display: flex; }
  #legend .lgbtn { min-height: var(--tap); display: inline-flex; align-items: center; gap: 6px; }
}
.lg { display: flex; gap: 6px; align-items: center; }
.lg svg { display: block; }
.lgbtn {
  background: none; border: none; font: inherit; color: var(--ink);
  cursor: pointer; padding: 2px 7px; margin: -2px 0;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
@media (hover: hover) {
  .lgbtn:hover { background: var(--ink); color: var(--paper); }
}
.lgbtn:active { background: var(--ink); color: var(--paper); }
.lgbtn.active { background: var(--ink); color: var(--paper); font-weight: 700; }

/* ---- tooltip: an ink caption card ---- */
#tooltip {
  position: absolute; z-index: 7; pointer-events: none; display: none;
  background: var(--ink); color: var(--paper);
  padding: 8px 12px; max-width: 280px;
}
#tooltip .t { font-weight: 700; }
#tooltip .k { font-size: var(--text--1); opacity: 0.75; }
#tooltip .c { font-size: var(--text--1); opacity: 0.55; }

/* ---- side panel ---- */
#panel {
  width: 404px; flex: 0 0 404px; background: var(--paper);
  border-left: 1px solid var(--line); display: none;
}
#panel.open { display: flex; flex-direction: column; }
#pscroll { overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
/* the grip only exists on the phone sheet */
#sheetgrip {
  display: none; justify-content: center; padding: 10px 0 6px;
  background: none; border: none; width: 100%; cursor: grab;
  touch-action: none; -webkit-tap-highlight-color: transparent; user-select: none;
}
.gripbar { width: 44px; height: 4px; background: var(--line); }
#panel .pbody { padding: 14px 20px 34px; }
/* plate header painted in the family's fill, cut at 12° */
#panel .phead {
  --cut: 1.1rem;
  padding: 12px 20px calc(14px + var(--cut));
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut) / 0.21256) 100%, 0 100%);
  background: var(--phue, var(--peri));
}
.pnav { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.pnav .spacer { flex: 1; }
.navbtn {
  border: none; background: none; color: var(--ink-soft); font-size: 17px;
  cursor: pointer; padding: 2px 8px; font-family: inherit; line-height: 1.2;
}
@media (hover: hover) {
  .navbtn:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
}
.navbtn:active:not(:disabled) { background: var(--ink); color: var(--paper); }
.navbtn:disabled { opacity: 0.3; cursor: default; }
.pnav-link {
  font-size: var(--text--1); font-weight: 600; color: var(--ink);
  text-decoration: underline; text-underline-offset: 3px; margin-right: 6px;
  background: none; border: none; font-family: inherit; cursor: pointer; padding: 0;
}
button.pnav-link.on { background: var(--ink); color: var(--paper); padding: 1px 7px; text-decoration: none; }
.extlinks button.on { background: var(--ink); color: var(--paper); }
#panel .backlink {
  font-size: var(--text--1); color: var(--ink); cursor: pointer;
  background: none; border: none; padding: 2px 4px; font-family: inherit;
  font-weight: 500; text-decoration: underline; text-underline-offset: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px;
}
#panel h2 {
  font-family: var(--font-display); font-weight: 600; font-size: 1.55rem;
  line-height: 1.12; letter-spacing: -0.005em;
}
#panel .eyebrow { margin-bottom: 2px; }
#panel .eyebrow.linky {
  background: none; border: none; cursor: pointer; padding: 0;
  font: inherit; font-size: var(--text-tag); font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft);
}
@media (hover: hover) {
  #panel .eyebrow.linky:hover { color: var(--ink); text-decoration: underline; }
}
/* the rank ladder inside panel headers: same format as the HUD and pages */
#panel .ranks { margin-top: 8px; }
#panel .rank { display: flex; align-items: baseline; gap: 10px; padding: 1px 0; }
#panel .rank .rk {
  width: 3.4rem; flex: none;
  font-size: var(--text-tag); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-soft);
}
#panel .rank button {
  background: none; border: none; padding: 0; text-align: left;
  font-family: var(--font-display); font-weight: 600; font-size: 0.95rem;
  color: var(--ink); cursor: pointer; line-height: 1.3;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (hover: hover) {
  #panel .rank button:hover { text-decoration: underline; text-underline-offset: 3px; }
}
/* bridge rows carry the target family as a mini plate */
.bridge-chip {
  --cut: 0.4rem;
  margin-left: auto; padding: 1px 8px; font-size: var(--text-tag);
  color: var(--ink); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 46%;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut) / 0.21256) 100%, 0 100%);
}
.family-swatch {
  width: 14px; height: 14px; flex: none; border: 1.5px solid var(--ink);
}
#panel .meta { color: var(--ink-soft); font-size: var(--text--1); margin: 6px 0 2px; }
#panel .figures { margin: 8px 0 2px; }
#panel .blurb { font-size: 0.875rem; margin-top: 10px; line-height: 1.5; }
#panel .desc { font-size: 0.875rem; margin-top: 10px; line-height: 1.55; }
#panel h3 {
  font-size: var(--text-tag); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-soft); margin: 20px 0 6px;
  display: flex; align-items: baseline; gap: 8px;
}
#panel h3 .count { font-weight: 400; letter-spacing: 0; text-transform: none; }
#panel ul { list-style: none; padding: 0; }
#panel li.row {
  display: flex; align-items: center; gap: 8px; padding: 3.5px 4px; cursor: pointer;
}
@media (hover: hover) {
  #panel li.row:hover { background: var(--wash, rgba(24,21,17,0.06)); }
}
#panel li.row:active { background: var(--wash, rgba(24,21,17,0.06)); }
#panel li.plain { padding: 2.5px 4px; }
.mark { flex: 0 0 9px; }
.rowlabel { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowmeta { margin-left: auto; font-size: var(--text-tag); color: var(--ink-soft); white-space: nowrap;
  font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.bar { height: 3px; background: var(--phue-deep, var(--peri-deep)); opacity: 0.6; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
#panel .chip { border: none; cursor: pointer; font-family: inherit; }
.tag {
  display: inline-block; font-size: var(--text-tag); padding: 1px 7px;
  border: 1px solid var(--line); color: var(--ink-soft); vertical-align: 2px;
  margin-left: 7px; white-space: nowrap;
}
.showmore {
  background: none; border: none; color: var(--link); font: inherit;
  font-size: var(--text--1); cursor: pointer; padding: 4px; text-decoration: underline;
  text-underline-offset: 2px;
}
.sibling {
  margin-top: 12px; padding: 10px 12px; background: var(--lilac);
  font-size: var(--text--1); cursor: pointer;
  --cut: 0.55rem;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut) / 0.21256) 100%, 0 100%);
}
@media (hover: hover) {
  .sibling:hover { filter: brightness(0.97); }
}
.sibling:active { filter: brightness(0.97); }
.sibling b { color: var(--ink); }
.extlinks { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.extlinks a, .extlinks button {
  font-size: var(--text--1); text-decoration: none; color: var(--ink); font-family: inherit;
  border: 1.5px solid var(--ink); padding: 5px 11px; background: none; cursor: pointer;
}
@media (hover: hover) {
  .extlinks a:hover, .extlinks button:hover { background: var(--ink); color: var(--paper); }
}
.extlinks a:active, .extlinks button:active { background: var(--ink); color: var(--paper); }
#panel .hint { color: var(--ink-soft); font-size: var(--text--1); margin-top: 16px; }
#panel .stat { display: flex; gap: 18px; margin-top: 10px; }
#panel .stat div { font-size: var(--text--1); color: var(--ink-soft); }
#panel .stat b { display: block; font-size: 1.15rem; color: var(--ink);
  font-family: var(--font-display); font-weight: 600;
  font-variant-numeric: tabular-nums; }
a.artist { color: inherit; text-decoration: none; }
@media (hover: hover) {
  a.artist:hover { text-decoration: underline; text-underline-offset: 2px; }
}
.artistrow { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.artistrow .via { font-size: var(--text--1); color: var(--ink-soft); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
/* the listening shelf: the first pick hangs large above an ink shelf rule
   with its placard; the rest form a contact grid of sleeves below it */
.shelf { margin-top: 6px; }
.shelf .cover {
  display: block; object-fit: cover; background: var(--phue, var(--peri));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.shelf a.sleeve, .shelf button.sleeve { display: block; flex: none; line-height: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease; }
@media (hover: hover) {
  .shelf a.sleeve:hover, .shelf button.sleeve:hover { transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(24, 21, 17, 0.18); }
}
.shelf button.sleeve { background: none; border: 0; padding: 0; width: 100%;
  cursor: pointer; }
.shelf-feature {
  /* the curator text starts level with the sleeve's top edge */
  display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-start;
  padding-bottom: 2px;
}
.albumby { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.albumby .via { flex: 1 1 auto; min-width: 0; }
/* the year as a tiny cut-paper plate in the family's fill — the site's own
   material instead of a bordered chip */
.shelf .tag {
  --cut: 0.5rem;
  border: none; background: var(--phue, var(--peri)); color: var(--ink);
  font-size: var(--text-tag); font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 11px 1px 8px; margin-left: 0; flex: none;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut) / 0.21256) 100%, 0 100%);
}
/* spotlight: sleeve one cell wide, sentence beside it; the caption spans the
   full shelf width below — title and artist each on one untruncated line,
   the year plate closing the artist's line at the right edge */
.feature-sleeve { width: calc((100% - 24px) / 3); }
.feature-sleeve .cover { width: 100%; height: auto; aspect-ratio: 1 / 1; }
.feature-caption { flex-basis: 100%; order: 2; display: flex;
  flex-direction: column; gap: 1px; min-width: 0; }
.feature-caption .albumtitle { white-space: nowrap; overflow: visible;
  text-overflow: clip; }
.feature-byline { display: flex; align-items: baseline; gap: 6px; }
.feature-byline .via { flex: none; white-space: nowrap; overflow: visible; }
.feature-byline .tag { margin-left: auto; }
.feature-why {
  flex: 1 1 120px; min-width: 0; margin: 0;
  font-size: var(--text--1); color: var(--ink-soft); font-style: italic;
}
.shelf-feature .placard { flex: 1 1 140px; }
/* the top pick's sleeve is exactly one grid cell wide: every cover on the
   shelf is the same size, the placard is what marks the spotlight */
.shelf-feature .cover { width: 100%; height: auto; aspect-ratio: 1 / 1; }
.placard { display: flex; flex-direction: column; gap: 3px; min-width: 0;
  padding-bottom: 2px; }
/* the contact grid is a square arrangement: three equal flexible columns, so
   six picks form a 3x2 block and three fill one row, cells as large as the
   panel allows */
.shelf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 12px; padding-top: 14px; }
.shelf-cell { margin: 0; min-width: 0; }
.shelf-cell .cover { width: 100%; height: auto; aspect-ratio: 1 / 1; }
.shelf-cell figcaption { display: flex; flex-direction: column; gap: 1px;
  padding-top: 5px; }
/* one small text style on the shelf: --text--1 throughout; hierarchy comes
   from weight and ink depth only (the placard title is the sole larger text) */
.albumtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: var(--text--1); font-weight: 500; }
.placard .albumtitle { white-space: normal; font-family: var(--font-display);
  font-size: 1.1rem; line-height: 1.25; }
.shelf .via { font-size: var(--text--1); color: var(--ink-soft); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.shelf .placard .albumwhy { font-style: italic; white-space: normal;
  overflow: visible; margin-top: 3px; }
.cover-fallback {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600; font-size: 1.3rem;
  color: var(--ink-soft);
  width: 100%; aspect-ratio: 1 / 1;
}
.shelf-feature .cover-fallback { font-size: 2.4rem; }
@media (prefers-reduced-motion: reduce) {
  .shelf a.sleeve, .shelf button.sleeve { transition: none; }
  .shelf a.sleeve:hover, .shelf button.sleeve:hover { transform: none; }
  .board a.board-link { transition: none; }
  .board a.board-link:hover { transform: none; }
}

/* the moodboard (see detail.css sibling): one community image per aesthetic,
   its median-cut palette as a swatch rule beneath — no text on swatches */
.board { margin: 6px 0 0; }
.board .board-img {
  display: block; width: 100%; height: auto;
  background: var(--phue, var(--peri));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.board a.board-link { display: block; line-height: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease; }
@media (hover: hover) {
  .board a.board-link:hover { transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(24, 21, 17, 0.18); }
}
.board-swatches { display: flex; height: 12px; margin-top: 6px; }
.board-swatch { flex: 1; }
.board-credit { margin-top: 4px; }
.board-credit a { font-size: var(--text-tag); color: var(--ink-soft);
  text-decoration: none; }
@media (hover: hover) {
  .board-credit a:hover { text-decoration: underline; }
}

/* path stepping */
.pathstep { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.pathstep button {
  background: var(--paper); border: 1.5px solid var(--ink); color: var(--ink);
  font: inherit; font-size: var(--text--1); font-weight: 500; padding: 4px 10px; cursor: pointer;
}
@media (hover: hover) {
  .pathstep button:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
}
.pathstep button:active:not(:disabled) { background: var(--ink); color: var(--paper); }
.pathstep button:disabled { opacity: 0.3; cursor: default; }
.pathstep .where { font-size: var(--text--1); color: var(--ink-soft); }

/* ---- overlay: intro card as a plate ---- */
#overlay {
  position: absolute; inset: 0; z-index: 20; display: flex; align-items: center;
  justify-content: center; background: color-mix(in srgb, var(--paper) 60%, transparent);
}
#overlay .card {
  background: var(--butter); border: none; max-width: 460px; margin: 16px;
  padding: 28px 30px calc(28px + 1.6rem);
  --cut: 1.6rem;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut) / 0.21256) 100%, 0 100%);
  max-height: calc(100dvh - 6rem); overflow-y: auto; overscroll-behavior: contain;
}
@media (max-width: 640px) {
  #overlay .card { padding: 22px 22px calc(22px + 1.6rem); margin: 12px; }
  #overlay h2 { font-size: 1.5rem; }
}
#overlay h2 {
  font-family: var(--font-display); font-weight: 600; font-size: 1.8rem;
  line-height: 1.1;
}
#overlay p { font-size: 0.9375rem; margin-top: 12px; line-height: 1.55; }
#overlay ul { margin: 12px 0 0; padding-left: 0; list-style: none; }
#overlay li { font-size: 0.9375rem; padding: 3px 0; }
#overlay li b { font-weight: 700; }
#overlay .btns { display: flex; gap: 10px; margin-top: 20px; }
#overlay .primary {
  background: var(--ink); color: var(--paper); border: none;
  padding: 10px 20px; font: inherit; font-weight: 600; cursor: pointer;
}
@media (hover: hover) {
  #overlay .primary:hover { opacity: 0.85; }
}
#overlay .primary:active { opacity: 0.7; }
#overlay .ghost {
  background: none; color: var(--ink); border: 1.5px solid var(--ink);
  padding: 10px 16px; font: inherit; font-weight: 500; cursor: pointer;
}
@media (hover: hover) {
  #overlay .ghost:hover { background: var(--ink); color: var(--paper); }
}
#overlay .ghost:active { background: var(--ink); color: var(--paper); }
#overlay .foot { font-size: var(--text--1); color: var(--ink-soft); margin-top: 14px; }

/* ---- fingers get honest targets ---- */
@media (max-width: 760px) {
  .tbtn { min-height: var(--tap); min-width: var(--tap); }
  #search { min-height: var(--tap); }
  .navbtn { padding: 8px 12px; }
  #panel li.row { padding: 8px 4px; }
  #hits .hit { padding: 10px 12px; }
  #crumb button { font-size: 1.05rem; padding: 3px 0; }
}

/* ---- one-row phone toolbar: search owns the slack, buttons stay square ---- */
@media (max-width: 760px) {
  #topbar {
    top: 8px;
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    flex-wrap: nowrap;
  }
  #searchwrap { flex: 1 1 auto; min-width: 0; max-width: none; }
  .tbtn-long { display: none; }
  .tbtn-short { display: inline; }
  #crumb {
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    max-width: min(380px, 72vw);
  }
}

/* ---- the sheet layout: map behind, panel as a fixed sheet ---- */
@media (max-width: 760px) {
  #panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 9;
    width: auto; flex: none; height: calc(100dvh - 3.5rem);
    border-left: none; border-top: 1.5px solid var(--ink);
    transform: translateY(100%); will-change: transform;
    padding-bottom: env(safe-area-inset-bottom);
  }
  #panel.snap { transition: transform 260ms cubic-bezier(0.2, 0.9, 0.3, 1); }
  #sheetgrip { display: flex; }
  /* drag surfaces own their gestures outright */
  #panel .phead { touch-action: none; }
  #panel:not([data-detent="full"]) #pscroll { overflow: hidden; touch-action: none; }
  #panel[data-detent="full"] #pscroll { touch-action: pan-y; }
  /* while the sheet is up its rank ladder replaces the crumb */
  body.sheet-open #crumb { display: none; }
  /* the spotlight caption's untruncated one-liners fit a 404px column, not
     a phone: let them wrap instead of running off the sheet */
  .feature-caption .albumtitle { white-space: normal; }
  .feature-byline { flex-wrap: wrap; }
  .feature-byline .via { white-space: normal; flex: 1 1 auto; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #panel.snap { transition: none; }
}
