/* Twelfth run: shared by the heart page and every system and region page, loaded after each page's own styles.
   - View controls: view buttons in anatomical terms (Anterior, Posterior, Right lateral, Left lateral, Superior, Inferior, Reset), a
     Left / Right / Both limb picker on the limb pages (with Medial and Lateral views when one limb is shown), and one row of round
     buttons: turn left, turn right, move up, move down, zoom out, zoom in. They sit together at the top of the 3D view.
   - Desktop: the 3D view runs up behind the title and tabs (a zoomed model is no longer cut off in a straight line under them), and the
     right-hand column starts at the top. The hint is its own line, larger, never inside a scroll box. The note card stays inside its
     column and scrolls inside itself when it is long, so it can never cover the top bar.
   Fonts, colours and button style are the page's own (the variables come from each page). */
.view { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: auto; }
.views { display: grid; grid-template-columns: repeat(4, auto); gap: 6px; justify-content: start; }
.views .ghost, .limbs .ghost { text-align: center; }
.limbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: flex-start; }
.limbs-k { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); margin-right: 2px; padding: 4px 8px; border-radius: 8px; background: var(--sheet); border: 1px solid var(--line); }   /* on a panel: it sat faint over the model */
.rail { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start; }
.rail button { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--sheet); color: var(--ink);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font: 500 18px/1 var(--body); cursor: pointer; }
.rail button:hover { border-color: var(--ink); }
.rail button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rail svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.app.media-on .rail, .app.media-on .limbs { visibility: hidden; }

/* the hint: larger, in full, never clipped */
.hint { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.hint strong { color: var(--ink); font-weight: 500; }
.sheet > .hint { padding: 2px 2px 0; }
.card[hidden] { display: none !important; }

@media (min-width: 900px) {
  .app { grid-template-rows: auto auto minmax(0, 1fr); }
  .stage-wrap { grid-row: 2 / 4; }
  header { grid-row: 2; flex-wrap: wrap; pointer-events: none; padding-bottom: 8px; }
  header .brand { pointer-events: auto; max-width: 100%; }
  .sheet { grid-row: 2 / 4; justify-content: flex-start; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-top: 10px; }
  .sheet > * { flex: none; }
  /* the note card shrinks to the room left in the column and scrolls inside itself */
  .sheet > .card { flex: 0 1 auto; min-height: 140px; max-height: none; overflow-y: auto; }
}
@media (max-width: 899px) {
  .view { align-items: flex-start; }
  .views, .limbs, .rail { justify-content: flex-start; }
  .card { max-height: none; }
}
@media (max-width: 600px) {
  .views { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 5px; }
  .rail { gap: 5px; }
  .rail button { width: 44px; height: 44px; }
  .limbs .ghost { min-width: 64px; }
  .hint { font-size: 15px; }
}

/* switched-off layer buttons in the dark theme: they nearly vanished (a faint fill and an edge the same colour as the page). They now keep
   a visible dashed edge and brighter text, so they read as buttons that are off, not as missing. */
:root[data-theme="dark"] .chip[aria-pressed="false"] { color: rgba(242, 242, 244, 0.82); border: 1px dashed #5A606A; background: rgba(255, 255, 255, 0.03); }
:root[data-theme="dark"] .chip[aria-pressed="false"] .dot { opacity: 0.6; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip[aria-pressed="false"] { color: rgba(242, 242, 244, 0.82); border: 1px dashed #5A606A; background: rgba(255, 255, 255, 0.03); }
  :root:not([data-theme="light"]) .chip[aria-pressed="false"] .dot { opacity: 0.6; }
}

/* phones: when a search moves the page to the controls, they keep a little room above them (they sat hard against the top edge) */
.rail { scroll-margin-top: 10px; }

/* phones (twelfth run, after the full suite): the round buttons are a column in the 3D view's top right corner, and the view buttons are
   a little shorter, so the 3D view starts high enough on a short phone (360 x 640) */
@media (max-width: 600px) {
  .stage-wrap > .rail { position: absolute; z-index: 3; top: 8px; right: 8px; flex-direction: column; flex-wrap: nowrap; gap: 6px; }
  .views .ghost, .limbs .ghost { padding-top: 8px; padding-bottom: 8px; }
  .stage-wrap { scroll-margin-top: 6px; }
}
