/* Masheen plate calculator (T64 stream B). Loaded on /tools/plate-calculator
   and its print sheet only. Tokens only, no colour literals on screen; the
   sheet is ink on paper. Motion: transform and opacity, with a still path. */

/* ---------------------------------------------------------------- the instrument */
.pc { display: grid; gap: clamp(20px, 4vw, 36px); }
.pc [hidden] { display: none !important; }
.pc-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 28px; }
.pc .stepper { max-width: 100%; }
.pc a.step-btn { flex: none; text-decoration: none; }
.pc a.step-btn[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.pc .pm-weight input { min-width: 2.3ch; max-width: 46vw; }
.pc-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--iron-raised); }
.pc-seg a { display: inline-grid; place-items: center; min-width: 64px; min-height: 44px; border-radius: var(--r-button); color: var(--chalk-dim); font: 700 18px/1 var(--f-display); letter-spacing: .5px; text-transform: uppercase; text-decoration: none; }
.pc-seg a[aria-current="true"] { background: var(--chalk); color: var(--on-chalk); }

/* the bar runs from gutter to gutter; its glow and whip are never clipped */
.pc-stage-wrap { padding-inline: var(--gutter); }
.pc-stage { position: relative; }
.pc-stage > svg { display: block; width: 100%; height: auto; overflow: visible; }
.pc-set .pm-label:not(.is-out) { fill: var(--on-chalk); }

.pc-result .tool-note { max-width: 44em; font-size: 16px; line-height: 1.5; }
.pc-near { display: flex; flex-wrap: wrap; align-items: center; gap: 0 24px; margin-top: 6px; min-height: 44px; color: var(--chalk-dim); font-size: 15px; }
.pc-jump { display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; color: var(--chalk); font-weight: 600; text-underline-offset: 3px; text-decoration-color: var(--steel-light); }

/* ---------------------------------------------------------------- bar and plates */
.pc-setup { display: grid; gap: 32px; }
.pc-setup::before { content: ""; height: 1px; background: var(--hairline); }
@media (min-width: 900px) {
  .pc-setup { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: 64px; }
  .pc-setup::before, .pc-actions { grid-column: 1 / -1; }
}
.pc-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.pc-group legend { padding: 0; margin-bottom: 12px; }
.pc-group .hint { margin-bottom: 14px; }

.pc-bars { display: flex; flex-wrap: wrap; gap: 8px; }
.pc-bar { position: relative; display: inline-flex; }
.pc-bar input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pc-bar-face { display: grid; align-content: center; justify-items: start; gap: 3px; min-width: 76px; min-height: 60px; padding: 8px 14px; border-radius: var(--r-button); background: var(--iron-raised); }
.pc-bar-face b { font: 700 24px/1 var(--f-display); letter-spacing: .3px; }
.pc-bar-face small { margin-left: .22em; font-size: .58em; font-weight: 600; opacity: .7; }
.pc-bar-face em { font-style: normal; font-size: 12px; line-height: 1.2; color: var(--chalk-dim); }
.pc-bar-face em:empty { display: none; }
.pc-bar-other .pc-bar-face b { font-size: 20px; text-transform: uppercase; letter-spacing: .5px; }
.pc-bar input:checked + .pc-bar-face { background: var(--chalk); color: var(--on-chalk); }
.pc-bar input:checked + .pc-bar-face em { color: inherit; opacity: .72; }
.pc-bar input:focus-visible + .pc-bar-face { outline: 2px solid var(--chalk); outline-offset: 3px; }
.pc-custom { display: inline-flex; align-items: center; gap: 8px; }
.pc-custom .input { width: 8.6em; min-height: 60px; }
.pc-custom-u { color: var(--chalk-dim); font-weight: 600; }

/* the plates you own, hung on a peg: pale when you have them, an outline when you do not */
.pc-rack { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 6px; }
.pc-plate { position: relative; display: inline-grid; place-items: center; width: 46px; height: 76px; }
.pc-plate::before { content: ""; position: absolute; left: -3px; right: -3px; top: 50%; height: 6px; margin-top: -3px; background: var(--steel); }
.pc-plate input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pc-plate-face { position: relative; display: grid; place-items: center; width: 100%; height: var(--h, 44px); border-radius: 8px; border: 2px dashed var(--steel-light); background: var(--iron-floor); color: var(--chalk-dim); font: 700 17px/1 var(--f-display); transition: transform 160ms ease-out; }
.pc-plate input:checked + .pc-plate-face { border: 0; background: var(--chalk); color: var(--on-chalk); box-shadow: inset 0 1.5px 0 var(--plate-hl); }
.pc-plate input:focus-visible + .pc-plate-face { outline: 2px solid var(--chalk); outline-offset: 3px; }
@media (hover: hover) { .pc-plate:hover .pc-plate-face { transform: translateY(-3px); } }

.pc-counts-box { margin-top: 14px; }
.pc-counts-box summary { cursor: pointer; list-style: none; }
.pc-counts-box summary::-webkit-details-marker { display: none; }
.pc-counts-box summary { position: relative; padding-left: 24px; }
.pc-counts-box summary::before, .pc-counts-box summary::after { content: ""; position: absolute; left: 0; top: 50%; width: 14px; height: 2px; margin-top: -1px; border-radius: 1px; background: var(--steel-light); }
.pc-counts-box summary::after { transform: rotate(90deg); }
.pc-counts-box[open] summary::after { transform: none; }
.pc-counts-box .hint { margin: 4px 0 12px; }
.pc-counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 12px; }
.pc-count { display: grid; gap: 6px; font-size: 14px; color: var(--chalk-dim); }
.pc-count b { color: var(--chalk); }
.pc-count .input { min-height: 48px; }

.pc-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.js .pc-submit { display: none; }
.pc-saved { flex-basis: 100%; }

/* ---------------------------------------------------------------- the tables under it */
.pc-tbl td:first-child a { display: inline-flex; align-items: center; min-height: 44px; }
.pc-tbl-bars td a.pc-load { display: flex; align-items: center; width: max-content; min-height: 44px; }
.pc-tbl-bars td.pc-src a { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 44px; }
.pc-tbl td:first-child:has(a) { padding-block: 1px; vertical-align: middle; }
.pc-tbl tr:has(td:first-child a) td { vertical-align: middle; }
.pc-tbl-bars td { vertical-align: top; }
.pc-tbl-bars td.pc-src { padding-block: 2px; }
/* on a phone each bar is a block: name and weight on one line, the note and its sources under it */
@media (max-width: 719px) {
  .pc-tbl-bars thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .pc-tbl-bars, .pc-tbl-bars tbody { display: block; }
  .pc-tbl-bars tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; padding: 14px 0 4px; border-bottom: 1px solid var(--hairline); }
  .pc-tbl-bars td { padding: 0; border: 0; }
  .pc-tbl-bars td:nth-child(2) { text-align: right; white-space: normal; max-width: 11em; font-weight: 600; }
  .pc-tbl-bars td:nth-child(3) { grid-column: 1 / -1; margin-top: 6px; color: var(--chalk-dim); }
  .pc-tbl-bars td:nth-child(3) a { color: var(--chalk); }
  .pc-tbl-bars td.pc-src { grid-column: 1 / -1; grid-row: 3; justify-self: end; margin-top: -44px; }
}
.pc-nowrap { white-space: nowrap; }
.pc-sources { padding-left: 1.6em; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.pc-sources li { padding-left: 4px; scroll-margin-top: 96px; }
.pc-read { display: block; margin-top: 2px; font-size: 13px; color: var(--chalk-dim); }

@media (prefers-reduced-motion: reduce) {
  .pc-plate-face { transition: none; }
  .pc-plate:hover .pc-plate-face { transform: none; }
}

/* ---------------------------------------------------------------- the print sheet */
.pc-sheet-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; }
.pc-sheet-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
.pc-sheet-form .input { width: 8.5em; min-height: 48px; }
.pc-sheet-form select.input { width: auto; min-width: 6.5em; padding-right: 12px; }
.pc-sheet-form .link-row { margin-left: auto; }
.pc-chart { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 5mm; margin-top: 5mm; }
.pc-col { min-width: 0; }
.pc-colhead, .pc-row { display: grid; grid-template-columns: 12mm minmax(0, 1fr) auto; align-items: center; column-gap: 2mm; }
.pc-colhead { height: 5mm; border-bottom: .35mm solid #111; font: 600 6.5pt/1 var(--f-body); letter-spacing: .06em; text-transform: uppercase; color: #333; }
.pc-colhead span:first-child, .pc-row b { text-align: right; }
.pc-row { height: 6.6mm; border-bottom: .2mm solid #bdbdbd; }
.pc-row b { font: 700 11.5pt/1 var(--f-display); font-variant-numeric: tabular-nums lining-nums; }
.pc-row .g { display: block; width: auto; max-width: 100%; height: 4.4mm; }
.pc-row .l { font-size: 7pt; line-height: 1; white-space: nowrap; color: #222; font-variant-numeric: tabular-nums lining-nums; }
.pc-row .l.is-none { color: #666; font-style: italic; }
.g-bar { fill: #9a9a9a; }
.g-collar { fill: #6a6a6a; }
.g-plate { fill: #111; }
.pc-tbl:not(.pc-tbl-bars) td { white-space: nowrap; }
