/* Hertz contact stress — on top of calc.css */
main.hz { --b1: var(--moment); --b2: var(--clamp); --pr: var(--x-8a4a8a, #8a4a8a); }
main.hz .stage-bar { justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
main.hz .stage-bar .hist { margin-left: auto; }

/* case picker: line icons */
.hz-case { display: flex; flex-wrap: wrap; gap: 4px; background: var(--fill-1); border-radius: 9px; padding: 2px; }
.hz-case button { border: 0; background: none; border-radius: 7px; padding: 3px 6px 2px; cursor: pointer; display: grid; justify-items: center; gap: 0; color: var(--text-3); font-size: 10.5px; line-height: 1.2; min-width: 58px; }
.hz-case button svg { width: 34px; height: 24px; display: block; }
.hz-case button svg * { vector-effect: non-scaling-stroke; }
.hz-case button:hover { color: var(--text); }
.hz-case button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); font-weight: 500; }
.hz-case button:focus-visible { outline: 2px solid var(--sel); outline-offset: 1px; }

#view { display: block; width: 100%; height: auto; flex: 1; min-height: 0; user-select: none; touch-action: none; }
#view.dragging, #view.dragging * { cursor: grabbing !important; }
#view .handle { cursor: grab; }
#view .handle.v { cursor: ns-resize; }
#view .handle.h { cursor: ew-resize; }
#view .handle.r { cursor: grab; }
#view .handle .knob { fill: var(--surface); stroke: var(--sel); stroke-width: 1.8; }
#view .handle:hover .knob { fill: var(--sel); }
#view .handle .hit { fill: transparent; }
#view .body1 { fill: var(--steel-100); stroke: var(--steel-700); stroke-width: 1; stroke-linejoin: round; }
#view .body2 { fill: var(--steel-200); stroke: var(--steel-650); stroke-width: 1; stroke-linejoin: round; }
#view .brk { fill: none; stroke: var(--steel-650); stroke-width: 1; }
#view .cl { stroke: var(--steel-500); stroke-width: .7; stroke-dasharray: 12 3 2 3; fill: none; }
#view .dimln { stroke: var(--steel-550); stroke-width: .8; fill: none; }
#view .lead { stroke: var(--steel-550); stroke-width: .8; fill: none; stroke-dasharray: 3 2; }
#view .frame { fill: var(--surface-2); stroke: var(--line); }
#view .vtitle { font-size: 11.5px; font-weight: 600; fill: var(--text-2); }
#view .cap { font-size: 11px; fill: var(--text-3); }
#view .lab { font-size: 11px; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#view .labb { font-size: 11.5px; font-weight: 600; fill: var(--text); font-variant-numeric: tabular-nums; }
#view.narrow .lab, #view.narrow .cap { font-size: 18px; }
#view.narrow .labb, #view.narrow .vtitle { font-size: 18.5px; }
#view .pill rect { fill: var(--surface); stroke: var(--steel-300); }
#view .pill text { font-size: 11.5px; font-weight: 500; fill: var(--text-2); font-variant-numeric: tabular-nums; }
#view.narrow .pill text { font-size: 18px; }
#view .pill.editable { cursor: text; }
#view .pill.editable:hover rect { stroke: var(--sel); stroke-width: 1.4; }
#view .pill.editable:focus { outline: none; }
#view .pill.editable:focus rect { stroke: var(--sel); stroke-width: 1.6; }
#view .pill.load rect { stroke: color-mix(in srgb, var(--load) 40%, transparent); } #view .pill.load text { fill: var(--load); font-weight: 600; }
#view .pill.b1 text { fill: var(--b1); } #view .pill.b2 text { fill: var(--b2); }
#view .pill.sel rect { stroke: var(--sel); } #view .pill.sel text { fill: var(--sel); font-weight: 600; }
#view .patch { stroke: var(--load); stroke-width: 3; stroke-linecap: round; }
#view .zoomring { fill: none; stroke: var(--sel); stroke-width: 1; stroke-dasharray: 3 2; }
#view .ins-frame { fill: none; stroke: var(--sel); stroke-width: 1.1; }
#view .ins-bg { fill: var(--surface-2); }
#view .surf { stroke: var(--ink); stroke-width: 1.2; fill: none; }
#view .pcurve { fill: color-mix(in srgb, var(--violet) 10%, transparent); stroke: var(--pr); stroke-width: 1.3; }
#view .tq { stroke: var(--load); stroke-width: 1.2; fill: none; }
#view .casel { stroke: var(--text); stroke-width: 1.2; stroke-dasharray: 6 3; }
#view .peak { fill: var(--surface); stroke: var(--x-111111, #111111); stroke-width: 1.6; }
#view .depthsel { stroke: var(--sel); stroke-width: 1; }
#view .dome-edge { fill: none; stroke: color-mix(in srgb, var(--ink) 55%, transparent); stroke-width: .7; }
#view .dome-foot { fill: none; stroke: var(--ink); stroke-width: 1.1; }
#view .axis3 { stroke: var(--steel-400); stroke-width: .7; stroke-dasharray: 2 2; fill: none; }
#view .dial { fill: var(--surface); stroke: var(--line-2); }
#view .dial-a { stroke-width: 2; stroke-linecap: round; }
#view .stale { fill: var(--surface); opacity: .5; }
#view .readout { font-size: 11.5px; font-weight: 600; fill: var(--text); font-variant-numeric: tabular-nums; }
#view.narrow .readout { font-size: 18px; }
#view [data-tip] { cursor: crosshair; }

.hz-live { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; min-height: 34px; align-items: center; }
.hz-live b { font-weight: 500; color: var(--text-3); margin-right: 4px; }
.hz-live .x-ok { color: var(--good); font-weight: 500; }
.hz-live .x-no { color: var(--bad); font-weight: 500; }
.hz-legend { justify-content: space-between; }
.hz-legend .seg button { padding: 3px 9px; }
.hz-legend .lg-l { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hz-scale { display: grid; gap: 2px; }
.hz-scale .bars { display: grid; grid-template-columns: repeat(11, 1fr); width: 220px; height: 9px; border-radius: 3px; overflow: hidden; }
.hz-scale .ticks { position: relative; width: 220px; height: 13px; font-size: 10.5px; color: var(--text-3); }
.hz-scale .ticks span { position: absolute; transform: translateX(-50%); top: 0; white-space: nowrap; }
@media (max-width: 560px) { .hz-scale .bars, .hz-scale .ticks { width: 200px; } }

/* in-place editor */
.hz-edit { position: absolute; transform: translate(-50%, -50%); z-index: 5; display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1.5px solid var(--sel); border-radius: 9px; padding: 2px 8px 2px 4px; box-shadow: 0 6px 18px rgba(20, 22, 28, .14); }
.hz-edit input { width: 92px; border: 0; outline: none; font: inherit; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 2px; }
.hz-edit span { font-size: 11.5px; color: var(--text-3); }
.stage { position: relative; }

/* panel bits */
.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12.5px; color: var(--text-2); margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; text-align: right; }
.f.segf { grid-template-columns: minmax(0, 1fr) auto; }
.f.segf .seg button { padding: 4px 9px; font-size: 12.5px; }
.f.segf.stack { grid-template-columns: minmax(0, 1fr); gap: 4px; }
.f.segf.stack .seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
.hz-helper { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; }
.hz-helper > summary { cursor: pointer; padding: 8px 0; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.hz-helper[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.hz-helper .btn { margin: 8px 0 10px; }
.bodyhead { display: flex; align-items: center; gap: 8px; }
.bodyhead i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.src-tag { font-size: 11px; color: var(--text-3); }
.src-tag a { color: var(--text-3); }

/* summary */
.hz-sum { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }
.story { padding: 14px 20px; display: grid; align-content: center; gap: 6px; min-width: 0; }
.story p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text); max-width: 76ch; }
.story p.sub { font-size: 12.5px; color: var(--text-2); }
.story .mode { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.hz-mini { display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); border-left: 1px solid var(--line); }
.hz-mini .stat { border-left: 0; border-top: 1px solid var(--line); }
.hz-mini .stat:nth-child(-n+2) { border-top: 0; }
.hz-mini .stat:nth-child(even) { border-left: 1px solid var(--line); }
@media (max-width: 1320px) {
  .hz-sum { grid-template-columns: minmax(0, 1fr); }
  .hz-mini { grid-template-columns: repeat(4, minmax(0, 1fr)); border-left: 0; border-top: 1px solid var(--line); }
  .hz-mini .stat { border-top: 0; border-left: 1px solid var(--line); }
  .hz-mini .stat:first-child { border-left: 0; }
}
@media (max-width: 700px) {
  .hz-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hz-mini .stat:nth-child(odd) { border-left: 0; }
  .hz-mini .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .story { padding: 12px 14px; }
}

/* margins */
#checks tr[data-check] { cursor: pointer; }
#checks td.note { white-space: normal; min-width: 180px; }
#checks td.l:first-child { white-space: normal; min-width: 140px; }
#checks .guide-tag { font-size: 11px; color: var(--text-3); margin-left: 6px; }
@media (max-width: 700px) {
  #checks th:nth-child(4), #checks td:nth-child(4) { display: none; }
  .margins td, .margins th { padding-left: 4px; padding-right: 4px; }
  .margins .ms { min-width: 54px; padding: 2px 6px; }
  #checks td.l:first-child { min-width: 0; }
  .step .eq .katex { font-size: .86em; }
}

/* charts + fixes */
.hz-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
@media (max-width: 1040px) { .hz-row { grid-template-columns: minmax(0, 1fr); } }
#dchart, #pchart { display: block; width: 100%; height: auto; touch-action: none; user-select: none; }
#dchart .drag { cursor: ns-resize; }
#pchart .drag { cursor: ew-resize; }
.ch-t { font-size: 10.5px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.ch-a { font-size: 11px; fill: var(--text-2); }
.ch-l { font-size: 11px; font-weight: 600; }
.fixes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px; }
.fix { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.fix b { font-weight: 600; font-size: 13.5px; }
.fix p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.fix .ms { margin-left: 6px; }
.fix.done { background: var(--surface-2); }
@media (max-width: 420px) { .fixes { grid-template-columns: minmax(0, 1fr); } }

/* steps */
details.step.gov > summary .t::after { content: "governs"; margin-left: 10px; font-size: 11px; font-weight: 600; color: var(--bad); letter-spacing: .03em; text-transform: uppercase; }
.step .where { font-size: 12px; color: var(--text-3); margin: 6px 0 0; line-height: 1.6; }
.step .eq { overflow-x: auto; overflow-y: hidden; }
.refs-body .md-src li { margin: 5px 0; }
.sec-tag { font-style: normal; font-size: 11px; color: var(--text-3); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; margin-left: 4px; }
.warns li { font-size: 12.5px; }

/* 3D view */
.hz3 .block-head { margin-bottom: 8px; }
.hz3-note { display: inline-flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: flex-end; }
#v3 { display: block; width: 100%; height: 400px; touch-action: none; cursor: grab; }
/* drawing on the left, the patch's figures and pressure bands beside it (stacked below on narrow screens) */
.hz3-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px 28px; }
@media (min-width: 1000px) { .hz3-grid { grid-template-columns: minmax(0, 1fr) 270px; align-items: center; } #v3 { height: 420px; } }
.hz3-side { min-width: 0; }
.hz3-h { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.hz3-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0 0 14px; font-size: 12.5px; }
.hz3-kv dt { color: var(--text-3); }
.hz3-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.hz3-bands { display: grid; grid-template-columns: 14px auto 1fr; gap: 3px 10px; align-items: center; margin: 0 0 12px; font-size: 12px; font-variant-numeric: tabular-nums; }
.hz3-bands i { display: block; width: 14px; height: 10px; border-radius: 2px; }
.hz3-bands span { color: var(--text-3); }
.hz3-bands b { font-weight: 500; text-align: right; color: var(--text); }
.hz3-cap { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.45; }
#v3.dragging { cursor: grabbing; }
@media (max-width: 700px) { #v3 { height: 300px; } }
.story p.why { color: var(--text-2); }
.story p.why b { font-weight: 600; color: var(--text); margin-right: 4px; }
.story p.why a { color: var(--text-3); }
.hz-read { margin: 4px 0 0; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.hz-read .muted { color: var(--text-3); }
@media (max-width: 480px) {
  #checks td:nth-child(2), #checks td:nth-child(3) { white-space: normal; font-size: 12px; line-height: 1.3; }
  #checks th { white-space: normal; }
  #checks .mui-n { gap: 6px; }
}

/* field labels wrap to a second line instead of an ellipsis ("Groove radius / d (typically 0.515–0.53)") */
main.hz .f > label span { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; }

/* gear helper: apply button and the link to the gears tool on one row (wraps on phones) */
.hz-hrow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.hz-hrow .hz-gl { font-size: 12.5px; color: var(--sel); text-decoration: none; }
.hz-hrow .hz-gl:hover { text-decoration: underline; }

/* theme-auto:start · generated by scripts/theme/hexmap.py: dark values (the rule of scripts/theme/colour.py) for
   colours that are not tokens, written as var(--x-rrggbb, #rrggbb): light is the fallback, unchanged */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --x-111111: #e2dfdb; --x-6e7177: #85827f; --x-7a5fa0: #b59ed8; --x-8a4a8a: #c990c8; --x-a87ba8: #cea8ce;
    --x-c19bc1: #b394b3; --x-ced3d9: #3e3c38; --x-cfd2d6: #3e3c39; --x-d6bad6: #634f63; --x-e7d6e7: #3c323d;
    --x-f4edf4: #2d282d;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --x-111111: #e2dfdb; --x-6e7177: #85827f; --x-7a5fa0: #b59ed8; --x-8a4a8a: #c990c8; --x-a87ba8: #cea8ce;
    --x-c19bc1: #b394b3; --x-ced3d9: #3e3c38; --x-cfd2d6: #3e3c39; --x-d6bad6: #634f63; --x-e7d6e7: #3c323d;
    --x-f4edf4: #2d282d;
  }
}
/* theme-auto:end */
