/* Grill calculator. Marker colour lives in style.css. No new text colours. */

html:not(.js) .calc { display: none; }

.nojs { border: 1px solid var(--border); padding: 10px 12px; color: var(--dim); margin: 0 0 14px; }

.calc-b .row { display: grid; grid-template-columns: 9ch minmax(0, 1fr); gap: 6px 10px; align-items: start; margin-bottom: 12px; }
/* Default brisket layout, so the empty rows do not jump when the script fills them. */
.calc-b .row-scale { min-height: 30px; }
.calc-b .row-cut { min-height: 62px; }
.calc-b .row-method { min-height: 33px; }
.calc-b .row-size { min-height: 108px; }
.calc-b .row-dials { min-height: 160px; }
.calc-b .card { min-height: 345px; }
.calc-b #dial-temp, .calc-b #dial-time { width: 150px; height: 150px; }
.calc-b .row > .rl { color: var(--faint); font-size: 12px; padding-top: 7px; }
.calc-b .cats { margin-bottom: 6px; }
.calc-b .cats .chip { font-size: 12px; min-height: 26px; padding: 1px 9px; }
.calc-b .cats .chip[aria-checked="true"] { background: transparent; color: var(--accent); border-color: var(--accent); }
.calc-b #inputs { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; }
.calc-b .fld .flbl { display: none; }
.calc-b .fld { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.calc-b .fld-wrap, .calc-b .fld-doneness { width: 100%; }
.calc-b .fld-wrap .flbl, .calc-b .fld-doneness .flbl { display: block; width: 100%; margin: 0; }

.knobs { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; margin: 6px 0 4px; min-width: 0; }
.knob-w { display: flex; align-items: center; gap: 10px; min-width: 0; }
.knob-w .kl { font-size: 12px; color: var(--faint); line-height: 1.5; max-width: 20ch; }
.knob-w .kl b { display: block; color: var(--h2); font-weight: 400; letter-spacing: .12em; text-transform: uppercase; }
.knob-w .kl .warn { color: var(--yellow); }
.dial-mini .dvn { font-size: 17px; }
.knob-w .dial-mini .tl { font-size: 10px; }

.card { border: 1px solid var(--border); background: var(--panel); padding: 12px 14px; margin-top: 14px; }
.card-h { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.plan-copy { font: inherit; font-size: 12px; color: var(--fg); background: transparent; border: 1px solid var(--border); padding: 3px 10px; min-height: 30px; cursor: pointer; white-space: nowrap; }
.plan-copy:hover { border-color: var(--accent); }
.card .big { font-size: 22px; color: var(--bright); line-height: 1.3; }
.card .big em { font-style: normal; color: var(--accent); }
.card .sub { color: var(--dim); font-size: 13px; margin: 2px 0 10px; }
.tline { position: relative; display: flex; height: 22px; border: 1px solid var(--border); background: var(--bg); }
.tline span { display: block; height: 100%; min-width: 2px; }
.tline .p-cook { background: var(--accent); }
.tline .p-stall { background: repeating-linear-gradient(135deg, var(--yellow) 0 4px, #b57614 4px 8px); }
.tline .p-rest { background: var(--green); }
.tline.probe .p-cook { background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 12px); }
.tline-x { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--faint); margin-top: 4px; gap: 8px; flex-wrap: wrap; }
.tline-x b { color: var(--fg); font-weight: 400; }
.start-at { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); }
.start-at input { font: inherit; font-size: 12px; color: var(--fg); background: var(--bg); border: 1px solid var(--border); min-height: 30px; padding: 2px 6px; }
.start-at input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--dim); margin-top: 8px; }
.legend .lg { display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; }
.legend .lg-cook { background: var(--accent); }
.legend .lg-stall { background: var(--yellow); }
.legend .lg-rest { background: var(--green); }
.card ul { margin: 10px 0 0; padding-left: 18px; color: var(--dim); font-size: 13px; }
.card li { margin: 0.2em 0; }

.tip { margin: 10px 0 0; font-size: 13px; color: var(--fg); border-left: 2px solid var(--yellow); padding-left: 8px; }
.tip b { color: var(--yellow); font-weight: 400; }
.exnote { color: var(--faint); font-size: 12px; border-left: 2px solid #fb4934; padding-left: 8px; margin: 18px 0 0; }

.dial { position: relative; display: inline-grid; place-items: center; touch-action: none; cursor: grab; border-radius: 50%; outline: none; -webkit-tap-highlight-color: transparent; user-select: none; }
.dial.drag { cursor: grabbing; }
.dial:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.dial svg { display: block; overflow: visible; }
.dial .track { fill: none; stroke: var(--row); stroke-width: 6; stroke-linecap: round; }
.dial .fill { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; }
.dial .knob { fill: var(--bright); stroke: var(--accent); stroke-width: 3; }
.dial .tl { fill: var(--faint); font-family: var(--font); font-size: 10px; text-anchor: middle; }
.dial .dv { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.dial .dvn { color: var(--bright); font-size: 22px; line-height: 1.1; }
.dial .dvu { color: var(--faint); font-size: 12px; }
.dial.off { opacity: .5; cursor: not-allowed; }
.dial.off .tl { visibility: hidden; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.chip { font: inherit; font-size: 13px; color: var(--fg); background: transparent; border: 1px solid var(--border); border-radius: 999px; padding: 3px 11px; min-height: 30px; cursor: pointer; }
.chip:hover { border-color: var(--faint-decor); }
.chip[aria-checked="true"] { color: var(--bg); background: var(--accent); border-color: var(--accent); font-weight: 700; }
.chip:focus-visible, .stp button:focus-visible, .tgl:focus-visible, .plan-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip[aria-disabled="true"] { color: var(--faint); border-style: dashed; text-decoration: line-through; cursor: help; }
.chip[aria-disabled="true"][aria-checked="true"] { color: var(--faint); background: transparent; border-color: var(--border); font-weight: 400; }
.chip .thin, .thin-flag { color: var(--yellow); font-size: 11px; margin-left: 2px; }
.why { color: var(--yellow); font-size: 13px; margin: 6px 0 0; }
.why b { color: var(--bright); font-weight: 400; }

.stp { display: inline-flex; align-items: stretch; border: 1px solid var(--border); }
.stp button { font: inherit; width: 36px; min-height: 36px; background: var(--panel); color: var(--accent); border: 0; cursor: pointer; font-weight: 700; }
.stp output { min-width: 7ch; display: grid; place-items: center; color: var(--bright); padding: 0 6px; border-inline: 1px solid var(--border); font-variant-numeric: tabular-nums; }

.tgl { font: inherit; display: inline-flex; gap: 8px; align-items: center; background: none; border: 1px solid var(--border); color: var(--fg); cursor: pointer; padding: 4px 10px; min-height: 36px; }
.tgl .bx { width: 14px; height: 14px; border: 1px solid var(--accent); display: inline-block; }
.tgl[aria-checked="true"] .bx { background: var(--accent); }
.flbl { color: var(--h2); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 6px; }
.flbl small { text-transform: none; letter-spacing: 0; color: var(--faint); font-size: 12px; }

details.more { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 8px; }
details.more summary { cursor: pointer; color: var(--dim); font-size: 13px; min-height: 24px; padding: 6px 0; }
details.more summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
details.more #more { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 10px; }
.calc-b #more .flbl { display: block; }

@media (min-width: 861px) { .knobs { flex-wrap: nowrap; } }
@media (max-width: 860px) {
  .calc-b .row-scale { min-height: 56px; }
  .calc-b .row-cut { min-height: 156px; }
  .calc-b .row-method { min-height: 94px; }
  .calc-b .row-size { min-height: 169px; }
  .calc-b .row-dials { min-height: 186px; }
  .calc-b .card { min-height: 525px; }
  .calc-b #dial-temp, .calc-b #dial-time { width: 112px; height: 112px; }
  .calc-b .row { grid-template-columns: minmax(0, 1fr); }
  .calc-b .row > .rl { padding: 0; }
  .knobs { gap: 10px; justify-content: space-between; flex-wrap: nowrap; }
  .knob-w { flex-direction: column; gap: 2px; text-align: center; }
  .knob-w .kl { max-width: 16ch; }
}
@media (prefers-reduced-motion: reduce) {
  .dial *, .chip, .tline span { transition: none !important; }
}
