/* =========================================================
   Sub-calculator pages — additions on top of styles.css
   ========================================================= */
:root { --teal: #6FC2B8; --dim: #56636E; }

.wordmark { cursor: pointer; }

/* stage head variants */
.z-readout.is-text { font-size: clamp(30px, 4.2vw, 50px); line-height: 1.05; }
.z-readout [hidden] { display: none; }
.stamp[hidden] { display: none; }

/* controls */
.ta { display: grid; gap: 6px; margin-bottom: 4px; }
.ta + .raw-info { margin-bottom: 10px; }
.ta-label { font: 500 15px/1 var(--f-display); color: var(--ink-2); }
.ta textarea {
  width: 100%; min-height: 64px; resize: vertical; padding: 10px;
  border-radius: 10px; border: 1px solid var(--rule); background: var(--card);
  font: 13px/1.5 var(--f-mono);
}
.ta textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(20, 29, 38, .08); }
.ta.is-bad textarea { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(224, 73, 43, .12); }
.btn-mini {
  margin-top: 4px; border: 1px solid var(--ink); background: transparent; border-radius: 999px;
  padding: 6px 14px; cursor: pointer; font: 500 13px var(--f-body);
}
.btn-mini:hover { background: var(--ink); color: var(--cream); }
.test-grid .test-glyph { font-size: 20px; }

/* readouts: column count follows card count on wide screens */
@media (min-width: 1281px) {
  .readouts.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readouts.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .readouts.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.readouts.n0 { display: none; }
.mscale { position: relative; height: 12px; font: 10.5px/1 var(--f-mono); color: var(--ink-3); }
.mscale span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.mscale span:first-child { transform: none; }
.mscale span:last-child { transform: translateX(-100%); }
.card .sub-line { font: 12px/1.4 var(--f-mono); color: var(--ink-3); }
.card .sub-line b { color: var(--ink); font-weight: 500; }

/* ---------- Visualization ---------- */
#viz { display: block; width: 100%; height: auto; touch-action: none; user-select: none; }
#viz.can-drag { cursor: ew-resize; }
.hatch-gold { stroke: var(--gold); stroke-width: 2.4; }
.hatch-teal { stroke: var(--teal); stroke-width: 2; }
.arrow-dim { fill: var(--dim); }
.arrow-on { fill: var(--gold); }

.v-grid { stroke: var(--stage-line); stroke-width: 1; }
.v-base { stroke: var(--dim); stroke-width: 1.2; }
.v-tick { stroke: var(--dim); stroke-width: 1; }
.v-tl { fill: #9AA5AE; font: 500 13px var(--f-mono); }
.v-tl.hi { fill: var(--cream); }
.v-ts { fill: #66737E; font: 500 11.5px var(--f-mono); }
.v-lab { fill: #A9B3BB; font: 500 13px var(--f-body); }
.v-lab-b { fill: var(--cream); font: 600 14px var(--f-body); }
.v-title { fill: #8C98A3; font: 600 11px var(--f-body); letter-spacing: .14em; text-transform: uppercase; }
.v-axis-name { fill: var(--gold); font: italic 600 15px var(--f-display); }
.v-big { fill: var(--cream); font: 600 30px var(--f-mono); letter-spacing: -.02em; }
.v-big.gold { fill: var(--gold); }
.v-mid { fill: var(--cream); font: 500 17px var(--f-mono); }

.v-curve { fill: none; stroke: var(--cream); stroke-width: 2.6; stroke-linejoin: round; }
.v-curve.thin { stroke-width: 1.4; opacity: .45; }
.v-curve.gold { stroke: var(--gold); }
.v-curve.teal { stroke: var(--teal); }
.v-curve.dash { stroke-dasharray: 6 6; stroke-width: 1.6; opacity: .55; }
.v-rej { fill: var(--accent); opacity: .88; }
.v-rej.soft { opacity: .5; }
.v-accfill { fill: rgba(243, 237, 225, .07); }
.v-hatch { fill: url(#hatch); }
.v-hatch-teal { fill: url(#hatchTeal); }
.v-fill-gold { fill: var(--gold); opacity: .22; }
.v-fill-teal { fill: var(--teal); opacity: .22; }
.v-fill-area { fill: var(--gold); opacity: .3; }
.v-band1 { fill: rgba(111, 194, 184, .22); }
.v-band2 { fill: rgba(111, 194, 184, .13); }
.v-band3 { fill: rgba(111, 194, 184, .07); }
.v-band-rej { fill: var(--accent); opacity: .85; }
.v-band-acc { fill: var(--teal); opacity: .32; }
.v-crit { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 5; }
.v-crit-t { fill: #F08C76; font: 500 13px var(--f-mono); }
.v-dash { stroke: var(--cream); stroke-width: 1.2; stroke-dasharray: 4 5; opacity: .55; }
.v-dash.gold { stroke: var(--gold); opacity: .9; }
.v-dash.teal { stroke: var(--teal); opacity: .9; }
.v-needle { stroke: var(--gold); stroke-width: 2.2; }
.v-needle.teal { stroke: var(--teal); }
.v-dot { fill: var(--stage); stroke: var(--gold); stroke-width: 2.5; }
.v-dot.teal { stroke: var(--teal); }
.v-dot.solid { fill: var(--gold); stroke: var(--stage); stroke-width: 2; }
.v-dot.solid.teal { fill: var(--teal); }
.v-dot.cream { fill: var(--cream); stroke: var(--stage); stroke-width: 1.5; }
.v-handle { fill: var(--gold); stroke: var(--stage); stroke-width: 3; }
.v-tag rect { fill: var(--gold); }
.v-tag text { fill: var(--stage); font: 600 13px var(--f-mono); }
.v-tag.teal rect { fill: var(--teal); }
.v-tag.cream rect { fill: var(--cream); }
.v-tag.accent rect { fill: var(--accent); }
.v-tag.accent text { fill: #fff; }
.v-bracket path { fill: none; stroke: var(--cream); stroke-width: 1.4; }
.v-bracket text { fill: var(--cream); font: 500 13px var(--f-mono); }
.v-bracket.gold path { stroke: var(--gold); }
.v-bracket.gold text { fill: var(--gold); }
.v-bracket.accent path { stroke: #F08C76; }
.v-bracket.accent text { fill: #F08C76; }

/* waffle */
.v-cell { fill: rgba(243, 237, 225, .08); }
.v-cell.on { fill: var(--gold); }
.v-cell.h0 { stroke: var(--teal); stroke-width: 1.6; }

/* bars */
.v-track { fill: rgba(243, 237, 225, .07); }
.v-bar-gold { fill: var(--gold); opacity: .85; }
.v-bar-teal { fill: var(--teal); opacity: .85; }
.v-whisk { stroke: var(--cream); stroke-width: 2; }

/* slope chart */
.v-slope { stroke-width: 1.6; fill: none; opacity: .75; }
.v-slope.up { stroke: var(--gold); }
.v-slope.down { stroke: var(--teal); }
.v-slope.flat { stroke: var(--cream); opacity: .5; }
.v-slope.mean { stroke: var(--cream); stroke-width: 4; opacity: 1; }

/* flowchart + matrix */
.v-node { fill: rgba(243, 237, 225, .05); stroke: var(--stage-line); stroke-width: 1.4; }
.v-node.on { stroke: var(--gold); fill: rgba(233, 180, 76, .1); }
.v-node.rej { stroke: var(--accent); fill: rgba(224, 73, 43, .16); }
.v-node.acc { stroke: var(--teal); fill: rgba(111, 194, 184, .14); }
.v-node.off { opacity: .45; }
.v-link { stroke: var(--dim); stroke-width: 2; fill: none; stroke-dasharray: 5 5; }
.v-link.on { stroke: var(--gold); stroke-dasharray: none; stroke-width: 2.6; }
.v-cellbox { fill: rgba(243, 237, 225, .04); stroke: var(--stage-line); stroke-width: 1.2; }
.v-cellbox.on { fill: rgba(233, 180, 76, .12); stroke: var(--gold); stroke-width: 1.8; }
.v-cellbox.off { opacity: .4; }
.v-faded { opacity: .4; }

/* triangle (Steiger) */
.v-edge { stroke-linecap: round; }
.v-edge.gold { stroke: var(--gold); }
.v-edge.teal { stroke: var(--teal); }
.v-edge.cream { stroke: var(--cream); opacity: .5; stroke-dasharray: 6 7; }
.v-vnode { fill: var(--stage); stroke: var(--cream); stroke-width: 2; }
.v-vnode.shared { stroke: var(--gold); fill: #2A2416; }
.v-vnode-t { fill: var(--cream); font: 700 20px var(--f-display); }
.v-edge-box { fill: var(--stage); stroke: var(--stage-line); }

/* legend swatches */
.sw-teal { background: var(--teal); }
.sw-gold { background: var(--gold); }
.sw-cream { background: var(--cream); }
.sw-band { background: rgba(111, 194, 184, .45); }
.sw-acc { background: rgba(111, 194, 184, .5); }
.sw-dash { width: 14px; height: 0; border-top: 2px dashed var(--cream); border-radius: 0; opacity: .7; }

/* ---------- Related calculators ---------- */
.related { max-width: 1480px; margin: 0 auto; padding: 0 32px 28px; }
.related h2 { margin: 0 0 12px; font: 600 13px/1 var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.related ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.related a {
  display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--card); color: var(--ink); text-decoration: none; font-size: 14px;
  transition: border-color .2s, background .2s;
}
.related a:hover { border-color: var(--ink-3); }
.related a[aria-current="page"] { background: var(--ink); color: var(--cream); border-color: var(--ink); }

@media (max-width: 640px) {
  .related { padding-left: 16px; padding-right: 16px; }
}
.related .related-h2b { margin-top: 22px; }
.dl-row { display: flex; flex-wrap: wrap; gap: 8px; }
.dl-row .btn-mini { margin-top: 0; }
.aov-wrap { display: block; overflow-x: auto; margin-top: 4px; }
.aov { border-collapse: collapse; font: 13px/1.4 var(--f-mono); min-width: 420px; }
.aov th, .aov td { padding: 4px 10px; text-align: right; border-bottom: 1px solid var(--rule); }
.aov th:first-child, .aov td:first-child { text-align: left; font-family: var(--f-body); }
.aov thead th { background: var(--paper-2); font-weight: 600; }
.aov tbody tr:last-child td { font-weight: 600; border-bottom: 0; }
