/* Mineral and rock identification chart. Uses section.css tokens, so it follows WhatStone's accent and the reader's
   light or dark setting. Phone: tests, then matches, with a bar at the bottom that jumps to them. Laptop: tests on
   the left, matches on the right. Print: the full chart alone. */

.ms > *, .ms-grid > *, .ms-top > * { min-width: 0; }
.ms { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); padding: 16px; display: grid; gap: 28px; }
.ms-grid { display: grid; gap: 24px; }
@media (min-width: 900px) {
  .ms { padding: 24px; }
  .ms-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
}

/* Tests */
.ms-tests-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 4px; }
.ms-intro { margin: 0; font-size: 15px; color: var(--ink-2); flex: 1 1 200px; }
.ms-test { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 14px 0 16px; min-width: 0; }
.ms-test legend { font-size: 17px; font-weight: 600; padding: 14px 0 0; float: left; width: 100%; }
.ms-test legend + * { clear: both; }
.ms-how { margin: 2px 0 10px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.ms-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.ms-opts label { position: relative; }
.ms-opts input { position: absolute; opacity: 0; inset: 0; margin: 0; pointer-events: none; }
.ms-opts span { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 15px; line-height: 1.25; color: var(--ink); cursor: pointer; background: var(--bg); }
.ms-opts span:hover { border-color: var(--ink-3); }
.ms-opts input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.ms-opts input[value=""]:checked + span { background: var(--bg-alt); color: var(--ink-2); border-color: var(--line); font-weight: 400; }
.ms-opts input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw { width: 16px; height: 16px; border-radius: 50%; flex: none; border: 1px solid rgb(0 0 0 / .2); }
.sw-white { background: #fafafa; } .sw-grey { background: #8d8d93; } .sw-black { background: #1b1b1d; } .sw-brown { background: #7a4d2b; }
.sw-red { background: #b3261e; } .sw-pink { background: #e7a1b0; } .sw-orange { background: #e07a1f; } .sw-yellow { background: #e9c93a; }
.sw-green { background: #3c8c4a; } .sw-blue { background: #2f6fc4; } .sw-purple { background: #7a4fb0; }
.sw-gold { background: #c9a640; } .sw-silver { background: #b7bcc4; }

.ms-btn { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 600 15px/1 var(--font); cursor: pointer; }
.ms-btn:hover { border-color: var(--ink-3); }
.ms-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Results */
.ms-results-head { background: var(--tint); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 12px; }
.ms-count { font-size: 24px; line-height: 1.2; margin: 0; }
.ms-next { margin: 8px 0 0; font-size: 15px; line-height: 1.5; }
.ms-next a { font-weight: 600; white-space: nowrap; }
.ms-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ms-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; }
.ms-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ms-card h3 { font-size: 18px; margin: 0; }
.ms-tag { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.ms-aka { margin: 2px 0 0; font-size: 14px; color: var(--ink-3); }
.ms-card-tell { margin: 6px 0 0; font-size: 15px; line-height: 1.5; }
.ms-failed { margin: 8px 0 0; font-size: 14px; color: var(--warn); }
.ms-card details { margin-top: 6px; font-size: 14px; }
.ms-card summary { cursor: pointer; color: var(--link); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.ms-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin: 0 0 10px; }
.ms-card dt { color: var(--ink-3); font-size: 12px; }
.ms-card dd { margin: 0; }
.ms-card details a { display: inline-flex; align-items: center; min-height: 44px; }
.ms-more, .ms-none { font-size: 15px; color: var(--ink-2); padding: 10px 2px; }
.ms-near h3 { font-size: 16px; margin: 20px 0 8px; }
.ms-limits { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--warn-bg); font-size: 15px; line-height: 1.5; }
.ms-limits p { margin: 0; }
.ms-limits strong { color: var(--warn); }

/* Phone: a bar that jumps from the tests to the matches. */
.ms-jump { display: none; }
@media (max-width: 899px) {
  .ms { margin-left: calc(var(--gutter) * -1 + 6px); margin-right: calc(var(--gutter) * -1 + 6px); padding: 14px; }
  .ms.ready.asked .ms-jump { display: flex; position: sticky; bottom: 12px; z-index: 5; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 0 20px; margin: -12px 0 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; box-shadow: 0 6px 20px rgb(0 0 0 / .18); }
  .ms-results { scroll-margin-top: 72px; }
  .ms-grid { gap: 8px; }
}

/* Chart */
.ms-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ms-chart-title { font-size: 21px; line-height: 1.3; margin: 0; }
.ms-chart-how { margin: 6px 0 12px; font-size: 15px; color: var(--ink-2); }
.ms-scroll { overflow: auto; max-height: 80vh; border: 1px solid var(--line); border-radius: var(--radius-sm); -webkit-overflow-scrolling: touch; }
.ms-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ms-table { border-collapse: separate; border-spacing: 0; font-size: 13px; line-height: 1.35; min-width: 1100px; width: 100%; }
.ms-table th, .ms-table td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.ms-table thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-alt); color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.ms-table tbody th { position: sticky; left: 0; z-index: 1; background: var(--bg); font-weight: 600; min-width: 128px; border-right: 1px solid var(--line); }
.ms-table thead th:first-child { left: 0; z-index: 3; border-right: 1px solid var(--line); }
.ms-kind { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.ms-tell { min-width: 260px; color: var(--ink-2); }
.ms-table tr.out > * { color: var(--ink-3); opacity: .45; }
.ms-table tbody tr:last-child > * { border-bottom: 0; }
.ms-chart-note { margin: 10px 0 0; font-size: 13px; color: var(--ink-3); }

/* Print: the whole chart, every row, on landscape pages. */
@media print {
  @page { size: landscape; margin: 10mm; }
  body > :not(main), main > :not(.doc), .doc > :not(.main), .main > :not(.tool), .tool > :not(.ms-chart) { display: none !important; }
  body, .doc, .main, .tool { background: #fff !important; color: #000; border: 0 !important; padding: 0 !important; margin: 0 !important; max-width: none !important; display: block !important; }
  .ms-btn, .ms-chart-how { display: none; }
  .ms-scroll { overflow: visible; max-height: none; border: 0; }
  .ms-table { min-width: 0; font-size: 8pt; }
  .ms-table th, .ms-table td { position: static !important; background: #fff !important; color: #000 !important; opacity: 1 !important; border-color: #aaa !important; padding: 3px 5px; }
  .ms-table thead th { background: #eee !important; }
  .ms-table tr { break-inside: avoid; }
  .ms-tell { min-width: 0; }
}
