/* TankVentSizingAltitude.html: calculator layout copied from
   ThreadStressCalculator.html (.sq-* frame, .tsc-* input sections and results).
   Reference cards come from css/kc-calc.css. */
.tsc * { box-sizing: border-box; }

/* ── Green wrapper token system (matches ORing-All-Sizes-Groove.html) ── */
:root {
  --sq-wrap:     #1d3f4b;
  --sq-outline:  rgb(67,67,67);
  --sq-panel:    #eeeeee;
  --sq-blue:     #1a6475;
  --sq-ink:      #1C2227;
  --sq-ink-soft: #5A6168;
  --sq-ui:       "Roboto","Roboto Fallback", Arial, sans-serif;
}
.sq-main { max-width: 1500px; margin: 0 auto; padding: 0 20px 60px; }
.sq-subtitle { font-family: var(--sq-ui); color: var(--sq-ink-soft); font-size: 15px; line-height: 1.5; max-width: 70ch; margin: 18px auto 22px; text-align: center; }
.sq-subtitle.sq-crosslink { margin-top: -12px; font-size: 14px; }
.sq-calc-grid { font-family: var(--sq-ui); display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 20px; align-items: start; background: var(--sq-wrap); border: 3px solid var(--sq-outline); border-radius: 18px; box-shadow: 0px 3px 5px 0 rgba(0,0,0,.4); padding: 20px; }
@media (max-width:960px) { .sq-calc-grid { grid-template-columns: 1fr; } }
.sq-panel { background: var(--sq-panel); border: 2px solid var(--sq-outline); border-radius: 10px; box-shadow: 0px 3px 5px 0 rgba(0,0,0,.4); overflow: hidden; }
.sq-panel-h { padding: 11px 16px; background: #fff; border-bottom: 2px solid var(--sq-outline); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--sq-ink); font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sq-panel-b { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
/* The input panel used to follow the scroll. It fought the page on anything
   but a tall window, so it stays put. */
.sq-sticky { position: static; }

/* ── Section cards ── */
.tsc-section {
  background: var(--calc-background-color);
  border: 2px solid var(--calc-outline-color);
  border-radius: 10px;
  padding: 11px 13px;
  box-shadow: 0 2px 5px rgba(0,0,0,.15);
}

/* Section heading */
.tsc-h2 {
  font-family: var(--title-font-family);
  font-size: 13px;
  font-weight: var(--font-weight-bold);
  background: var(--section-title-color);
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}

/* Form labels */
.tsc label {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  color: #444;
  font-family: var(--body-font-family);
}

/* Inputs & selects */
.tsc input[type=number],
.tsc select {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid #9aabb0;
  border-radius: var(--border-radius-small);
  font-size: 13px;
  font-family: var(--body-font-family);
  background: #fff;
  color: #222;
}
.tsc input[type=number]:focus,
.tsc select:focus { outline: 2px solid var(--section-title-color); }
.tsc input[readonly] { background: #ececec !important; }

/* Grid helpers */
.tsc-r2 { display: grid; grid-template-columns: 1fr 1fr;     gap: 8px; }
.tsc-r3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
/* Major dia + TPI: the TPI box only needs a few digits. */
.tsc-r-dt { display: grid; grid-template-columns: 1fr 0.55fr; gap: 8px; }
.tsc-field { margin-bottom: 8px; }
.tsc-sep   { border-top: 1px solid #c8d0da; margin: 10px 0; }
.tsc-note  { font-size: 11px; color: #666; margin-top: 4px; font-family: var(--body-font-family); }

/* Thread info box */
.tsc-thread-info {
  background: #eef4fb;
  border: 1px solid #b0c8e0;
  border-radius: var(--border-radius-small);
  padding: 8px;
  font-size: 12px;
  margin-bottom: 8px;
  font-family: var(--body-font-family);
}
.tsc-thread-info table { width: 100%; }
.tsc-thread-info td { padding: 2px 6px; }
.tsc-thread-info td:first-child { font-weight: bold; color: #1a3a5c; }

/* Custom material/thread highlight */
#tsc-custom-material-inputs { background: #fffbe6; border: 1px solid #e0c060; border-radius: 6px; padding: 8px; margin-top: 6px; }

/* Calculate button */
.tsc-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: var(--font-weight-bold);
  font-family: var(--title-font-family);
  background: var(--section-title-color);
  color: #fff;
  border: none;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  transition: background .2s;
  box-shadow: 0 2px 5px rgba(0,0,0,.2);
}
.tsc-btn:hover { background: #4a6a72; }
.tsc-actions { align-self: end; }
/* Calculate and Copy link side by side. share-link.js stacks its button
   under a full-width one with inline styles, hence the !important. */
.tsc-input-grid > .tsc-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.tsc-actions > .tsc-btn { flex: 1 1 160px; width: auto; }
.tsc-actions > #shareLinkBtn { display: inline-flex !important; align-items: center; justify-content: center; margin: 0 !important; }
.tsc-btn.tsc-btn-secondary { background: #fff; color: var(--section-title-color); border: 1.5px solid var(--section-title-color); padding: 9px 12px; font-size: 13.5px; box-shadow: none; }
.tsc-btn.tsc-btn-secondary:hover { background: var(--section-title-color); color: #fff; }

/* Result table */
.tsc-result-table { width: 100%; border-collapse: collapse; font-size: 13px; font-family: var(--body-font-family); }
.tsc-result-table th { background: var(--section-title-color); color: #fff; padding: 5px 8px; text-align: left; font-size: 12px; }
.tsc-result-table td { padding: 5px 8px; border-bottom: 1px solid #dde; }
.tsc-result-table tr:nth-child(even) td { background: #f2f4f7; }

/* Margin of safety colors */
.tsc-ms-pos { color: #1a7a1a; font-weight: bold; }
.tsc-ms-neg { color: #b00000; font-weight: bold; }

/* Calc block (monospace intermediate values) */
.tsc-calc-block {
  background: #f8f9fb;
  border: 1px solid #dde;
  border-radius: 6px;
  padding: 10px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  line-height: 1.8;
  white-space: pre-wrap;
}
.tsc-calc-block b { color: #1a3a5c; }

/* Summary cards */
.tsc-summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tsc-summary-card { border: 1px solid #c8d0da; border-radius: 6px; padding: 8px; background: #fff; }
.tsc-summary-card .val { font-size: 18px; font-weight: bold; }
.tsc-summary-card .lbl { font-size: 11px; color: #666; }

/* Critical torque cards */
.tsc-torque-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.tsc-torque-card { border: 2px solid var(--section-title-color); border-radius: 8px; padding: 10px; text-align: center; background: #fff; }
.tsc-torque-card.ult { border-color: #a03030; }
.tsc-torque-card .t-val { font-size: 22px; font-weight: bold; color: var(--section-title-color); }
.tsc-torque-card.ult .t-val { color: #a03030; }
.tsc-torque-card .t-lbl { font-size: 11px; color: #666; margin-top: 2px; }
.tsc-torque-card .t-sub { font-size: 11px; color: #444; margin-top: 4px; }

/* Collapsible intermediate header */
.tsc-intermed-hdr {
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; padding: 6px 10px;
  background: var(--section-title-color);
  border-radius: 6px 6px 0 0;
  user-select: none;
}
.tsc-intermed-hdr span { font-size: 14px; font-weight: bold; color: #fff; font-family: var(--title-font-family); }
.tsc-intermed-body { padding: 10px; background: var(--calc-background-color); border: 2px solid var(--calc-outline-color); border-top: none; border-radius: 0 0 6px 6px; }

/* Parametric sweep highlight */
.tsc-sweep-hl { background: #fffbe6 !important; }

.tsc-chart-box { position: relative; width: 100%; background: #fff; border: 1px solid #dde; border-radius: 6px; padding: 6px; }

/* Hidden helper */
.tsc-hidden { display: none; }

/* Collapsible input sections: the heading is the toggle */
details.tsc-collapse > summary.tsc-h2 {
  cursor: pointer; list-style: none; display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 0; user-select: none;
}
details.tsc-collapse[open] > summary.tsc-h2 { margin-bottom: 10px; }
details.tsc-collapse > summary::-webkit-details-marker,
details.tsc-sub > summary::-webkit-details-marker { display: none; }
details.tsc-collapse > summary.tsc-h2::after { content: '\25B6'; font-size: 11px; transition: transform .2s; }
details.tsc-collapse[open] > summary.tsc-h2::after { transform: rotate(90deg); }
details.tsc-sub {
  margin-top: 8px; border: 1px solid #c8d0da; border-radius: 6px; background: #fff;
}
details.tsc-sub > summary {
  cursor: pointer; list-style: none; padding: 6px 10px; font-size: 12px; font-weight: 600;
  color: #2c3e48; font-family: var(--body-font-family); display: flex;
  justify-content: space-between; align-items: center;
}
details.tsc-sub > summary::after { content: '+'; color: #5f6b70; font-size: 14px; }
details.tsc-sub[open] > summary::after { content: '\2212'; }
details.tsc-sub[open] > summary { border-bottom: 1px solid #c8d0da; }
.tsc-sub-b { padding: 8px 10px 4px; }
.tsc label.tsc-chk {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #333;
  margin: 4px 0 8px; cursor: pointer;
}
.tsc label.tsc-chk input { width: 15px; height: 15px; accent-color: var(--section-title-color); }

/* Results area — flex column so gap works between tsc-section cards */
#tsc-results-area { display: flex; flex-direction: column; gap: 12px; }
#tsc-results-area.tsc-hidden { display: none; }   /* the id rule above outranks .tsc-hidden */

/* Input panel — 2-column grid */
/* Two independent columns (1-3-5 | 2-4-6) rather than a grid, so a
   collapsed card sits directly under the card above it instead of
   being stretched to the height of its row-mate. */
.tsc-input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.tsc-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.sq-seg { display: inline-flex; flex-wrap: wrap; border: 1.5px solid rgb(67,67,67); border-radius: 6px; overflow: hidden; width: fit-content; }
/* Button colours come from site-chrome.css, as on the other calculators. */
.sq-seg button { appearance: none; font: 600 12.5px/1 "Roboto","Roboto Fallback", Arial, sans-serif; padding: 7px 14px; cursor: pointer; }
/* Explainer tooltips, same look as the other calculators. The box is
   positioned by script (position: fixed) so it never clips at the edge
   of the narrow inputs panel. */
.tooltip-icon { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; margin-left: 4px; vertical-align: 1px; border-radius: 50%; background: #1a6475; color: #fff; font: 700 9.5px/1 Roboto, Arial, sans-serif; font-style: normal; cursor: help; user-select: none; }
summary .tooltip-icon { background: #fff; color: #1a6475; }
.tooltip-icon:focus-visible { outline: 2px solid #73dae5; outline-offset: 1px; }
.tooltip-box { display: none; position: fixed; z-index: 10000; width: max-content; max-width: 300px; background: #1a3a40; color: #eee; font: 400 12px/1.55 Roboto, "Roboto Fallback", Arial, sans-serif; text-transform: none; letter-spacing: normal; text-align: left; padding: 8px 11px; border-radius: 6px; border: 1px solid #3a6270; box-shadow: 0 3px 8px rgba(0,0,0,.4); white-space: normal; pointer-events: none; }
.tooltip-box b { color: #fff; }
.tooltip-box.show { display: block; }
/* One column: dissolve the column wrappers and put the cards back in
   1-6 order with `order`. */
@media (max-width: 760px) {
  .tsc-input-grid { display: flex; flex-direction: column; }
  .tsc-col { display: contents; }
}
mjx-container { color: #1a3a40 !important; margin: 0; }
mjx-container[jax="SVG"][display="true"] { margin: 0.7em 0 !important; }
mjx-container[jax="SVG"] { margin: 0 !important; }

/* ── Page additions ── */
.tv-mode { display: grid; grid-template-columns: 1fr; gap: 6px; }
.tv-mode label.tsc-chk { margin: 0; align-items: flex-start; }
.tv-mode label.tsc-chk input { margin-top: 1px; }
.tv-mode small { display: block; color: #5f6b70; font-size: 11px; }
.tsc-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tsc-torque-card .t-ok { color: #1a7a1a; font-weight: 700; }
.tsc-torque-card .t-bad { color: #b00000; font-weight: 700; }
.tv-verdict { font-family: var(--body-font-family); font-size: 13.5px; line-height: 1.5; background: #fff; border: 1px solid #c8d0da; border-left: 4px solid #1a6475; border-radius: 6px; padding: 8px 10px; }
.tv-warn { font-family: var(--body-font-family); font-size: 12px; line-height: 1.5; background: #fff8e6; border-left: 3px solid #cc7700; border-radius: 0 6px 6px 0; padding: 6px 10px; color: #5a3a00; }
.tv-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tv-scroll .tsc-result-table { min-width: 560px; }
.tv-scroll .tsc-result-table td, .tv-scroll .tsc-result-table th { white-space: nowrap; text-align: right; }
.tv-scroll .tsc-result-table td:first-child, .tv-scroll .tsc-result-table th:first-child { text-align: left; }
.tv-data { max-width: 58rem; margin: 22px auto 0; font-family: "Roboto","Roboto Fallback", Arial, sans-serif; }
.tv-data h2 { font-size: 16px; font-weight: 700; color: #1a6475; text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 6px; }
.tv-data p { font-size: 13px; color: #333; line-height: 1.6; margin: 0 0 8px; }
.tv-data .ref-table td, .tv-data .ref-table th { white-space: nowrap; text-align: right; }
.tv-data .ref-table td:first-child, .tv-data .ref-table th:first-child { text-align: left; }
.tv-static { font-family: var(--body-font-family); font-size: 13px; color: #333; line-height: 1.55; padding: 4px 6px; }
.tv-static ul { padding-left: 18px; margin: 6px 0; }
@media (max-width: 760px) { .tsc-card-grid { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .sq-main { padding: 0 8px 40px; } .sq-calc-grid { padding: 8px; border-radius: 12px; } .sq-panel-b { padding: 10px; } .tsc-r2, .tsc-r3 { grid-template-columns: 1fr; } }

/* data-show fields: the hidden attribute must beat display:grid on .tsc-r2/.tsc-r3 */
.tsc [hidden] { display: none !important; }
/* One column: stretch the cards to full width (the grid rule sets align-items: start). */
@media (max-width: 760px) { .tsc-input-grid { align-items: stretch; } }
