/* Patient body map (2026-10-19): the step 1 card, the sheet it opens and
   the figure's box. What sits beside the figure (concerns and recommendation)
   lives in public/body-map-view.css, loaded after this. Colours, corners
   and type come from theme.css and styles.css; the figure's own drawing
   colours live in public/body-figure.js. */

/* The clinic's colour, tinted on this theme's own ground, so a selected
   state and recommendation read the same in light and dark. */
.bodymap-card,
.bodymap-dialog {
  --bm-tint: color-mix(in srgb, var(--accent) 14%, var(--ground));
  --bm-accent-text: color-mix(in srgb, var(--accent) 65%, var(--ink));
}

/* ------------------------------------------------------------ the card */
.bodymap-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  column-gap: 12px;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--ground);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition:
    border-color 0.12s ease,
    background-color 0.12s ease;
}
.bodymap-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-soft-ink);
}
.bodymap-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.bodymap-card-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-card);
  background: var(--bm-tint);
}
.bodymap-card-mark svg {
  display: block;
  height: 48px;
  width: auto;
  overflow: visible;
}
.bodymap-card-mark .bf-body {
  fill: var(--ground);
  stroke: var(--accent);
  stroke-width: 3.2;
  stroke-linejoin: round;
}
.bodymap-card-mark .bf-lines {
  display: none;
}
.bodymap-card-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 5;
}
.bodymap-card-dot {
  fill: var(--accent);
}
.bodymap-card-text {
  display: block;
  min-width: 0;
}
.bodymap-card-lead {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.bodymap-card-line {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.bodymap-card:hover .bodymap-card-line {
  color: inherit;
}

/* The clinic shell stays visible; only the modal's inner panel scrolls. */
html.bodymap-locked,
html.bodymap-locked body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
.bodymap-dialog {
  position: fixed;
  inset: var(--bm-top, 0px) 0 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 16px 24px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  overflow: hidden;
}
.bodymap-dialog[open] {
  display: grid;
  place-items: center;
}
.bodymap-dialog::backdrop {
  background: var(--modal-backdrop);
  -webkit-backdrop-filter: blur(var(--modal-backdrop-blur));
  backdrop-filter: blur(var(--modal-backdrop-blur));
}
.bodymap-sheet {
  display: flex;
  flex-direction: column;
  width: min(1000px, 100%);
  height: min(720px, 100%);
  min-height: 0;
  overflow: hidden;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-lift);
}
.bodymap-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  flex: none;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.bodymap-title {
  grid-column: 2;
  margin: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.bodymap-title:focus,
.bodymap-q:focus {
  outline: none;
}
.bodymap-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.bodymap-icon[hidden] {
  display: none;
}
.bodymap-icon:first-child {
  grid-column: 1;
}
.bodymap-icon:last-child {
  grid-column: 3;
}
.bodymap-icon:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.bodymap-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.bodymap-body {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr);
  gap: 32px;
  flex: 1;
  min-height: 0;
  padding: 24px 32px;
  overflow: hidden;
}
.bodymap-figcol {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}
.bodymap-figure-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 100%;
  min-height: 44px;
}
.bodymap-sheet[data-mode="spot"] .bodymap-sides {
  display: none;
}
.bodymap-sides {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
}
.bodymap-sides button {
  min-width: 96px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  background: var(--ground);
  color: var(--ink-soft);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}
.bodymap-sides button + button {
  border-left: 1px solid var(--line-strong);
}
.bodymap-sides button[aria-pressed="true"] {
  background: var(--bm-tint);
  color: var(--ink);
}
.bodymap-sides button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.bodymap-sheet[data-mode="spot"] .bodymap-figure-controls {
  display: none;
}
.bodymap-host {
  flex: 1;
  width: 100%;
  min-height: 0;
}
.bodymap-sheet[data-zoom="1"] .bodymap-host {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}
.bodymap-figure-note {
  flex: none;
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}
/* Hide immediately from sight and keyboard navigation while inspecting. */
.bodymap-sheet[data-mode="spot"] .bodyfig-rings,
.bodymap-dialog .bodyfig--zoom .bodyfig-rings,
.bodymap-sheet[data-mode="spot"] .bodymap-ring {
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 640px) {
  .bodymap-dialog {
    padding: 0;
  }
  .bodymap-sheet {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .bodymap-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 24px;
    padding: 24px;
  }
  .bodymap-figure-note {
    font-size: 16px;
  }
  .bodymap-sheet[data-mode="spot"] .bodymap-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    overflow-anchor: none;
    scroll-padding-block: 24px;
  }
  .bodymap-sheet[data-mode="spot"] .bodymap-figcol {
    flex: none;
    height: 240px;
  }
  .bodymap-sheet[data-mode="spot"] .bodymap-figcol:has([data-cutaway="ready"]) {
    height: auto;
  }
  .bodymap-host:has([data-cutaway="ready"]),
  .bodyfig--cutaway[data-cutaway="ready"] {
    flex: none;
    height: auto;
    aspect-ratio: auto;
  }
  .bodyfig--cutaway[data-cutaway="ready"] .bf-cutaway {
    position: relative;
    overflow: visible;
  }
  .bodymap-sheet[data-mode="spot"] .bodymap-pane {
    flex: none;
  }
  .bodymap-sheet[data-mode="spot"] .bodymap-scroll {
    flex: none;
    overflow: visible;
    padding: 0;
    scrollbar-gutter: auto;
  }
  .bodymap-sheet[data-mode="spot"][data-zoom="0"] .bodymap-figcol {
    display: none;
  }
  .bodymap-sheet[data-mode="spot"][data-zoom="0"] .bodymap-body {
    grid-template-rows: minmax(0, 1fr);
  }
}
