/* ==========================================================
   Tube Volume Calculator — styles
   ========================================================== */
:root {
  --bg: #f2f5fb;
  --bg-grad: radial-gradient(900px 520px at 88% -8%, rgba(47, 107, 255, .16) 0%, transparent 62%),
             radial-gradient(760px 480px at -6% 22%, rgba(0, 184, 217, .11) 0%, transparent 60%),
             radial-gradient(1100px 620px at 50% 115%, rgba(47, 140, 255, .09) 0%, transparent 60%);
  --bg-grid-minor: rgba(30, 60, 110, .045);
  --bg-grid-major: rgba(30, 60, 110, .075);
  --bg-art: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 600' fill='none' stroke='%232f6bff' stroke-opacity='.22'%3E%3Ccircle cx='300' cy='300' r='250' stroke-width='2'/%3E%3Ccircle cx='300' cy='300' r='190' stroke-width='2'/%3E%3Ccircle cx='300' cy='300' r='220' stroke-width='1' stroke-dasharray='3 7'/%3E%3Cpath d='M300 10v580M10 300h580' stroke-width='1' stroke-dasharray='24 6 3 6'/%3E%3Cpath d='M300 300l134 -134' stroke-width='1.5'/%3E%3Cpath d='M50 590h500M50 578v24M550 578v24' stroke-width='1.2'/%3E%3C/svg%3E");
  --surface: #ffffff;
  --surface-2: #f3f6fa;
  --surface-3: #e9eef5;
  --border: #e1e7ef;
  --border-strong: #cdd6e2;
  --text: #0e1828;
  --muted: #5a6a80;
  --faint: #637287;
  --accent: #2f6bff;
  --accent-soft: #e6eeff;
  --danger: #d93a3f;
  --danger-soft: #fdecec;
  --grid: rgba(30, 60, 110, 0.07);
  --dim: #6b7b92;
  --shadow: 0 1px 2px rgba(16, 30, 54, .05), 0 8px 24px -12px rgba(16, 30, 54, .12);
  --shadow-lg: 0 2px 4px rgba(16, 30, 54, .04), 0 24px 48px -24px rgba(16, 30, 54, .22);
  --stage-bg: linear-gradient(180deg, #fbfcfe 0%, #f1f5fb 100%);
  --cavity: #1b2536;
  --radius: 18px;
  --radius-sm: 12px;

  /* set from JS: material + liquid colors */
  --mat: #8f9baa;
  --mat-light: #d6dde6;
  --mat-dark: #5b6675;
  --liq: #2f8cff;
  --liq-light: #8cc3ff;
  --liq-dark: #1a5fc0;
  --air: #c9d3e0;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}


* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-grad), var(--bg);
  background-color: var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* Page background: drafting-paper grid that fades down the page, plus a faint
   tube cross-section drawn in blueprint lines. Both layers sit behind all content. */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
}
body::before {
  inset: 0;
  background-image:
    linear-gradient(var(--bg-grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid-major) 1px, transparent 1px),
    linear-gradient(var(--bg-grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid-minor) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(ellipse 110% 75% at 50% 0%, #000 25%, transparent 80%);
  mask-image: radial-gradient(ellipse 110% 75% at 50% 0%, #000 25%, transparent 80%);
}
body::after {
  top: -170px;
  inset-inline-end: -190px;
  width: 620px;
  height: 620px;
  background: var(--bg-art) center / contain no-repeat;
}
@media (max-width: 720px) {
  body::after { width: 380px; height: 380px; top: -110px; inset-inline-end: -150px; }
}
@media print {
  body::before, body::after { display: none; }
}
h1, h2, h3, h4, .t-panel, .t-card, .t-section, .t-formula { margin: 0; letter-spacing: -0.02em; }
button, input, select { font: inherit; color: inherit; }
code { font-family: var(--mono); }

.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 600; letter-spacing: -0.01em; font-size: 16px; }
.brand-mark { width: 30px; height: 30px; }
.brand-mark rect { fill: var(--accent); }
.brand-mark ellipse, .brand-mark path { fill: none; stroke: #fff; stroke-width: 2.4; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.topnav { display: flex; align-items: center; gap: 4px; }
.icon-btn.menu-btn { display: none; }
.topnav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; padding: 8px 12px; border-radius: 10px; }
.topnav a:hover { color: var(--text); background: var(--surface-2); }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; margin-left: 6px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; }

/* ---------- intro ---------- */
.intro { padding: 36px 0 24px; max-width: 760px; }
.intro h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; line-height: 1.1; }

/* ---------- layout ---------- */
.tool { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- controls ---------- */
.controls { padding: 20px; position: sticky; top: 76px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.t-panel { font-size: 16px; font-weight: 700; }

.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 5px 9px; border-radius: 7px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--border); }
.seg-sm button { font-size: 12px; padding: 4px 9px; }

.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; cursor: pointer;
  padding: 5px 11px; font-size: 12.5px; font-weight: 500; color: var(--muted);
  transition: border-color .15s, color .15s, background .15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.field { margin-bottom: 16px; }
.field-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.field label { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.key {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px;
  font-family: var(--mono); font-size: 12px; font-weight: 600; font-style: italic;
  background: var(--surface-3); color: var(--muted);
}
.key.k-od { background: color-mix(in srgb, var(--mat) 26%, transparent); color: var(--text); }
.key.k-f { background: color-mix(in srgb, var(--liq) 22%, transparent); color: var(--liq-dark); font-style: normal; }
.num {
  display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 0 10px 0 2px; width: 140px; transition: border-color .15s, box-shadow .15s;
}
.num:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.num input {
  width: 100%; min-width: 0; border: 0; background: transparent; outline: none; padding: 8px 8px;
  font-family: var(--mono); font-size: 14px; font-weight: 500; text-align: right;
}
.num input::-webkit-inner-spin-button { opacity: .4; }
.num .u { font-size: 12px; color: var(--faint); font-weight: 500; white-space: nowrap; }
.field.bad .num { border-color: var(--danger); background: var(--danger-soft); }
.field.derived .num { background: transparent; border-style: dashed; }
.field.derived .range { opacity: .45; }

.field-mode { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -2px 0 14px; font-size: 12.5px; color: var(--muted); }

/* range */
.range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; cursor: pointer;
  --p: 50%;
}
.range::-webkit-slider-runnable-track {
  height: 6px; border-radius: 6px;
  background: linear-gradient(90deg, var(--accent) 0 var(--p), var(--surface-3) var(--p) 100%);
}
.range::-moz-range-track { height: 6px; border-radius: 6px; background: var(--surface-3); }
.range::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--accent); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; margin-top: -6px;
  background: #fff; border: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: transform .12s;
}
.range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.range:active::-webkit-slider-thumb { transform: scale(1.15); }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.range-fill::-webkit-slider-runnable-track { background: linear-gradient(90deg, var(--liq) 0 var(--p), var(--surface-3) var(--p) 100%); }
.range-fill::-moz-range-progress { background: var(--liq); }
.range-fill::-webkit-slider-thumb { border-color: var(--liq); }

.hint { font-size: 12px; color: var(--faint); margin: 6px 0 0; }
.error {
  margin: -4px 0 14px; padding: 9px 12px; border-radius: 10px; font-size: 13px;
  background: var(--danger-soft); color: var(--danger); font-weight: 500;
}
.divider { height: 1px; background: var(--border); margin: 18px 0; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.select { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
select {
  appearance: none; -webkit-appearance: none; width: 100%;
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%238b99ad' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center / 12px;
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 30px 8px 10px;
  font-size: 13.5px; font-weight: 500; color: var(--text); cursor: pointer;
}
select:focus { outline: none; border-color: var(--accent); }
.custom-density { margin-top: 12px; }

/* ---------- stage ---------- */
.stage-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.stage {
  position: relative; overflow: hidden; padding: 0;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--stage-bg);
  box-shadow: var(--shadow-lg);
}
.stage-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px 0; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-mat i { background: var(--mat); }
.lg-liq i { background: var(--liq); }
.lg-air i { background: var(--air); }
.scale-note {
  font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--surface-2);
  border: 1px dashed var(--border-strong); padding: 3px 9px; border-radius: 999px;
}
.view3d { display: block; width: 100%; height: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
.drag-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); margin: 0;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 12px; color: var(--faint); font-weight: 500; pointer-events: none;
}
.drag-hint svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* SVG drawing classes */
.dim-line { stroke: var(--dim); stroke-width: 1.1; fill: none; }
.dim-ext { stroke: var(--dim); stroke-width: .8; stroke-dasharray: 3 3; fill: none; opacity: .7; }
.dim-txt { fill: var(--text); font-family: var(--mono); font-size: 13px; font-weight: 600; }
.dim-sub { fill: var(--muted); font-family: var(--font); font-size: 11px; font-weight: 500; }
.dim-pill { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1; }
.tag-pill { fill: var(--liq); }
.tag-txt { fill: #fff; font-family: var(--mono); font-size: 12px; font-weight: 600; }
.svg-grab { cursor: ns-resize; }

/* hover linking: dims everything except the hovered region */
.v-region { transition: opacity .25s; }
body[data-focus="material"] .v-region:not(.r-material),
body[data-focus="bore"] .v-region:not(.r-bore):not(.r-liquid),
body[data-focus="liquid"] .v-region:not(.r-liquid) { opacity: .18; }
body[data-focus] .bd-list li { opacity: .45; }
body[data-focus="material"] .bd-list li[data-k="material"],
body[data-focus="liquid"] .bd-list li[data-k="liquid"],
body[data-focus="bore"] .bd-list li[data-k="liquid"],
body[data-focus="bore"] .bd-list li[data-k="air"] { opacity: 1; }

/* ---------- hero results ---------- */
.hero-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; position: relative; }
.hero-card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px 15px; box-shadow: var(--shadow); overflow: hidden; cursor: default;
  transition: transform .2s, box-shadow .2s, border-color .2s; min-width: 0;
}
.hero-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c); }
.hero-card::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 18%, transparent), transparent 70%);
}
.hero-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 50%, var(--border)); box-shadow: var(--shadow-lg); }
.hc-mat { --c: var(--mat); }
.hc-bore { --c: var(--air); }
.hc-liq { --c: var(--liq); }
.hc-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.hc-label small { font-weight: 500; color: var(--faint); font-size: 12px; }
.hc-value {
  display: block; font-family: var(--mono); font-size: clamp(22px, 2.4vw, 30px); font-weight: 600;
  letter-spacing: -0.03em; margin-top: 6px; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.hc-value .unit { font-size: .55em; color: var(--muted); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.hc-sub { display: block; margin-top: 4px; font-size: 12px; color: var(--faint); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vol-unit { position: static; grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 10px; font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: -4px; }
.vol-unit select { width: auto; padding: 6px 30px 6px 10px; font-size: 13px; }

/* ---------- viz row ---------- */
.viz-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.xsec, .breakdown { padding: 16px 18px 18px; }
.xsec { display: flex; flex-direction: column; }
.xsec #viewX { margin: auto; }
.t-card { font-size: 14px; font-weight: 700; }
#viewX { display: block; width: 100%; max-width: 360px; margin: 6px auto 0; touch-action: none; user-select: none; }
.donut-wrap { position: relative; width: 190px; max-width: 70%; margin: 10px auto 6px; }
#donut { display: block; width: 100%; height: auto; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; padding: 0 30px; }
.donut-center span { font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: -0.03em; }
.donut-center small { font-size: 11px; color: var(--muted); line-height: 1.3; }
.donut-seg { transition: stroke-dasharray .1s linear; }
.bd-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.bd-list li { display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: 10px; font-size: 13px; transition: opacity .2s; }
.bd-list i { width: 10px; height: 10px; border-radius: 3px; }
.bd-list .v { font-family: var(--mono); font-weight: 500; font-size: 12.5px; }
.bd-list .p { font-family: var(--mono); color: var(--faint); font-size: 12px; min-width: 48px; text-align: right; }

/* ---------- details ---------- */
.details { padding: 16px 18px 6px; }
.details-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0 24px; margin: 10px 0 0; }
.stats > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.stats dt { font-size: 13px; color: var(--muted); }
.stats dd { margin: 0; font-family: var(--mono); font-size: 13.5px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stats dd small { color: var(--faint); font-weight: 500; }

/* ---------- formula ---------- */
.formula { margin-top: 28px; padding: 24px; }
.t-section { font-size: 22px; font-weight: 800; }
.lead { color: var(--muted); margin: 6px 0 18px; }
.f-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.f-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; background: var(--surface-2); border-left: 3px solid var(--c); min-width: 0; }
.f-mat { --c: var(--mat); }
.f-bore { --c: var(--air); }
.f-liq { --c: var(--liq); }
.f-mass { --c: var(--accent); }
.t-formula { font-size: 13.5px; font-weight: 700; margin-bottom: 10px; }
.f-sym { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.f-num { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.7; overflow-wrap: anywhere; }
.f-num b { color: var(--text); font-weight: 600; }


/* footer styles live in the "site chrome" block below */

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
  transition: opacity .2s, transform .2s; z-index: 50; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .tool { grid-template-columns: 1fr; }
  .controls { position: static; }
  .controls { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
  .controls > .panel-head, .controls > .presets, .controls > .divider, .controls > .error, .controls > .field-mode { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .icon-btn.menu-btn { display: grid; }
  .topnav {
    display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 2px;
    padding: 10px 16px 14px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
  }
  .topnav.open { display: flex; }
  .topnav a { padding: 12px; font-size: 15px; }
  .intro { padding: 24px 0 18px; }
  .controls { display: block; padding: 16px; }
  .panel-head { flex-wrap: wrap; }
  .hero-results { grid-template-columns: 1fr; gap: 10px; }
  .vol-unit { order: -1; justify-content: space-between; margin: 0; }
  .viz-row { grid-template-columns: 1fr; }
  .f-grid { grid-template-columns: 1fr; }
  .formula { padding: 18px; }
  .drag-hint { position: static; transform: none; display: flex; justify-content: center; padding: 0 0 12px; }
  .stage-head { padding: 12px 14px 0; }
}
@media (max-width: 380px) {
  .seg button { padding: 5px 7px; }
  .two { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ==========================================================
   Site chrome: skip link, footer, language switcher, content pages
   ========================================================== */
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; transition: top .15s;
}
.skip-link:focus { top: 12px; }
.menu-btn svg { stroke-width: 2; }
a:focus-visible, button:focus-visible, summary:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* how it works */
.how { margin-top: 28px; padding: 24px; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0 0 22px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.steps li { counter-increment: step; position: relative; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 46px 16px 16px; }
.steps li::before {
  content: counter(step); position: absolute; left: 16px; top: 14px; width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 700;
}
.step-t { margin: 0 0 6px; font-weight: 700; font-size: 14px; }
.step-d { margin: 0; color: var(--muted); font-size: 13.5px; }
.uses-title { margin-bottom: 8px; }
.uses { margin: 0; padding-inline-start: 20px; color: var(--muted); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 28px; }

/* footer */
.footer { border-top: 1px solid var(--border); margin-top: 28px; padding: 36px 0 26px; color: var(--muted); font-size: 13.5px; background: color-mix(in srgb, var(--surface) 55%, transparent); }
.footer-grid { display: grid; grid-template-columns: 1.3fr .8fr .8fr 2fr; gap: 28px; }
.f-brand p { margin: 12px 0 0; max-width: 280px; }
.f-title { margin: 0 0 10px; font-size: 12.5px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .04em; }
.f-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--accent); }
.lang-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px 14px !important; }
.lang-list a[aria-current] { color: var(--accent); font-weight: 700; }
.f-bottom { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--faint); font-size: 12.5px; }

/* content pages */
.page { padding-top: 28px; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 18px; font-size: 13px; color: var(--muted); }
.breadcrumb li + li::before { content: "/"; margin-inline-end: 6px; color: var(--faint); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.prose { max-width: 760px; }
.prose h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; line-height: 1.1; margin-bottom: 12px; }
.prose h2 { font-size: 20px; font-weight: 750; margin: 30px 0 10px; }
.prose h3 { font-size: 16px; font-weight: 700; margin: 20px 0 6px; }
.prose p, .prose li { color: var(--muted); }
.prose p { margin: 0 0 12px; }
.prose ul { padding-inline-start: 22px; margin: 0 0 14px; display: grid; gap: 6px; }
.prose a { color: var(--accent); }
.prose strong { color: var(--text); }
.page-lead { font-size: 17px; color: var(--text) !important; margin-bottom: 18px !important; }
.muted { color: var(--faint) !important; font-size: 13.5px; }
.t-sub { margin: 24px 0 8px !important; font-weight: 700; color: var(--text) !important; font-size: 16px; }
.sitemap-langs { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* contact form */
.contact-form { padding: 22px; margin: 22px 0 28px; display: grid; gap: 16px; }
.form-row { display: grid; gap: 6px; }
.form-row label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.form-row input, .form-row textarea {
  width: 100%; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 15px;
}
.form-row textarea { resize: vertical; min-height: 140px; }
.form-row input:focus, .form-row textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; padding: 10px 18px; font-size: 14px; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); border-color: transparent; }
.btn:disabled { opacity: .6; cursor: progress; }
.form-status { margin: 0 !important; font-size: 14px; font-weight: 600; }
.form-status.sending { color: var(--muted) !important; }
.form-status.success { color: #138a4b !important; }
.form-status.error { color: var(--danger) !important; }

/* 404 */
.notfound { padding: 30px 0 10px; }
.nf-code { font-family: var(--mono); font-size: 72px; font-weight: 700; color: var(--accent) !important; line-height: 1; margin-bottom: 10px !important; }
.nf-links { list-style: none; padding: 0 !important; display: flex !important; flex-wrap: wrap; gap: 10px; }
.nf-links a { text-decoration: none; }
.nf-links .btn:not(.primary) { color: var(--text); padding: 10px 16px; font-size: 14px; }

/* RTL: drawings, numbers and sliders stay left-to-right */
[dir="rtl"] svg, [dir="rtl"] .num, [dir="rtl"] .range, [dir="rtl"] code, [dir="rtl"] .hc-value, [dir="rtl"] .stats dd, [dir="rtl"] .bd-list .v { direction: ltr; }
[dir="rtl"] .num input { text-align: right; }
[dir="rtl"] .icon-btn { margin-left: 0; margin-right: 6px; }
[dir="rtl"] select { background-position: left 10px center; padding: 8px 10px 8px 30px; }
[dir="rtl"] .hero-card::after { right: auto; left: -30px; }
[dir="rtl"] .bd-list .p { text-align: left; }
[dir="rtl"] .vol-unit { justify-content: flex-start; }
[dir="rtl"] .f-card { border-left-width: 1px; border-right: 3px solid var(--c); }
[dir="rtl"] .steps li::before { left: auto; right: 16px; }
[dir="rtl"] .skip-link { left: auto; right: 12px; }

@media (max-width: 1080px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .how { padding: 18px; }
  .steps, .uses { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .f-brand, .f-lang { grid-column: 1 / -1; }
  .lang-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sitemap-langs { grid-template-columns: 1fr; }
  .page { padding-top: 20px; }
}

/* ==========================================================
   Sub-calculator pages
   ========================================================== */
.sub .intro { padding-top: 4px; }
.sub-select { margin-bottom: 16px; }
.viz { max-height: 520px; }
.steps-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.steps-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1000px) { .steps-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .steps-5 { grid-template-columns: 1fr; } }
.mini-calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 6px 0 4px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.mini-calc label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.mini-calc input, .mini-calc select { padding: 9px 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-family: var(--mono); font-size: 14px; }
.mini-calc input:focus, .mini-calc select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.mini-out { margin: 0 0 18px; }
.seo-sec .table-scroll code { font-family: var(--mono); font-size: 12.5px; }
.how .lead { margin: 0 0 12px; }
.f-ex { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.related { margin-top: 28px; padding: 24px; }
.rel-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.rel-list a, .hub-list a {
  display: block; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; transition: border-color .15s, background .15s;
}
.rel-list a:hover, .hub-list a:hover { border-color: var(--accent); background: var(--accent-soft); }
.prose.wide { max-width: none; }
.hub-list { list-style: none; padding: 0 !important; margin: 0 0 8px !important; display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px !important; }
.hub-list a b { display: block; color: var(--text); margin-bottom: 4px; }
.hub-list a span { display: block; color: var(--muted); font-weight: 400; font-size: 13px; line-height: 1.45; }
.chart-wrap { margin-top: 28px; padding: 24px; }
.table-scroll { overflow-x: auto; margin-top: 12px; }
.vol-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.vol-table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
.vol-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.vol-table td:first-child { font-family: var(--font); font-weight: 600; }
.vol-table tr.on td { background: var(--accent-soft); color: var(--accent); }
[dir="rtl"] .vol-table th { text-align: right; }

/* drawing labels */
.meter-d { fill: #fff; font-family: var(--mono); font-size: 24px; font-weight: 700; }
.meter-l { fill: #3c4652; font-family: var(--font); font-size: 14px; font-weight: 600; }
.gauge-n { fill: #1b2536; font-family: var(--mono); font-size: 13px; font-weight: 600; }
.strip-n { fill: #fff; font-family: var(--mono); font-size: 13px; font-weight: 700; }
.scale-d { fill: #4cff7a; font-family: var(--mono); font-size: 24px; font-weight: 700; }
.big-op { fill: var(--text); font-family: var(--font); font-size: 44px; font-weight: 300; }

@media (max-width: 1080px) {
  .rel-list, .hub-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .steps-3, .rel-list, .hub-list { grid-template-columns: 1fr; }
  .related, .chart-wrap { padding: 18px; }
}

/* ==========================================================
   Homepage SEO sections and FAQ
   ========================================================== */
.seo-sec { margin-top: 28px; padding: 24px; }
.seo-sec .lead b, .faq-a b { color: var(--text); }
.sec-viz { display: block; width: 100%; max-width: 720px; height: auto; margin: 8px auto 18px; }
.plain-list { margin: 0 0 18px; padding-inline-start: 22px; color: var(--muted); display: grid; gap: 6px; }
.seo-sec .uses { margin-bottom: 18px; }
.seo-sec .table-scroll { margin: 4px 0 18px; }
.seo-sec .lead a { color: var(--accent); }
.seo-sec .f-grid { margin-top: 8px; }
.faq-item { padding: 16px 0; border-top: 1px solid var(--border); }
.faq-item:first-of-type { border-top: 0; }
.faq-q { margin: 0 0 8px; font-weight: 700; font-size: 16px; color: var(--text); }
.faq-a { margin: 0; color: var(--muted); line-height: 1.65; }
@media (max-width: 720px) { .seo-sec { padding: 18px; } }

/* ---------- pipe volume: fill time, spreadsheet, tool cards ---------- */
.pv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 6px 0 22px; }
.pv-card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 16px; min-width: 0;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}
.pv-kicker { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.pv-title { margin: 0 0 14px; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.pv-title b { color: var(--text); }
.pv-title code { background: var(--surface-3); padding: 2px 6px; border-radius: 6px; font-size: .9em; color: var(--text); }
.pv-note { margin: 12px 0 0; font-size: 13px; color: var(--faint); line-height: 1.5; }

.eq { display: flex; align-items: stretch; gap: 8px; }
.eq-tile {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 12px 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
}
.eq-v { font-family: var(--mono); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; color: var(--text); white-space: nowrap; }
.eq-l { font-size: 11.5px; color: var(--faint); font-weight: 600; }
.eq-op { align-self: center; font-size: 22px; color: var(--faint); font-weight: 300; }
.eq-ans { background: var(--accent); border-color: var(--accent); }
.eq-ans .eq-v, .eq-ans .eq-l { color: #fff; }

.sheet { border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: var(--surface); font-size: 12.5px; }
.sheet-bar { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.sheet-bar .fx { font-style: italic; font-weight: 700; color: #1f8f4e; font-family: Georgia, serif; }
.sheet-bar code { font-size: 12.5px; color: var(--text); }
.sheet-grid { display: grid; grid-template-columns: 26px 1fr 0.8fr 1fr 1fr; }
.sheet-grid span { padding: 6px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.sheet-grid .hd, .sheet-grid .rn { background: var(--surface-3); color: var(--faint); text-align: center; font-size: 11px; font-weight: 600; padding: 3px 4px; }
.sheet-grid .th { font-weight: 700; font-size: 12px; }
.sheet-grid .cnum { font-family: var(--mono); text-align: right; }
.sheet-grid .sel { outline: 2px solid #1f8f4e; outline-offset: -2px; background: color-mix(in srgb, #1f8f4e 12%, transparent); font-weight: 700; }

.pv-tools-title { margin-top: 4px; margin-bottom: 10px; }
.tool-cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tool-cards a {
  position: relative; height: 100%; display: flex; flex-direction: column; gap: 6px; padding: 16px 16px 40px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tool-cards a:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.tc-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); margin-bottom: 4px; }
.tc-ic svg { width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tc-t { font-weight: 700; font-size: 14px; color: var(--text); line-height: 1.3; }
.tc-d { font-size: 13px; color: var(--muted); line-height: 1.45; }
.tc-go { position: absolute; left: 16px; bottom: 12px; color: var(--accent); font-weight: 700; transition: transform .15s; }
.tool-cards a:hover .tc-go { transform: translateX(4px); }
[dir="rtl"] .tc-go { left: auto; right: 16px; }

@media (max-width: 1080px) { .tool-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .pv-grid, .tool-cards { grid-template-columns: 1fr; }
  .eq-v { font-size: 15px; }
  .sheet-grid { grid-template-columns: 22px 1fr 0.7fr 0.9fr 1fr; }
}
.pv-wide { margin: 6px 0 22px; }
.tool-cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 720px) {
  .eq { flex-wrap: wrap; }
  .eq-tile { flex: 1 1 40%; }
  .tool-cards-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .eq { flex-direction: column; flex-wrap: nowrap; gap: 4px; }
  .eq-tile { flex: none; padding: 10px 6px; }
  .eq-op { line-height: 1; }
  .sheet { font-size: 11.5px; }
  .sheet-grid span { padding: 6px 5px; }
}

/* ---------- FAQ cards (homepage + every sub-calculator) ---------- */
.faq-sec { counter-reset: faq; }
.faq-sec .t-section { margin-bottom: 16px; }
.faq-item {
  counter-increment: faq; position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 14px;
  padding: 18px 20px; margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%); transition: border-color .15s, box-shadow .15s;
}
.faq-item:first-of-type { border-top: 1px solid var(--border); margin-top: 0; }
.faq-item:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow); }
.faq-item::before {
  content: "Q" counter(faq); grid-row: 1 / span 2; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-family: var(--mono); font-weight: 700; font-size: 13px;
}
.faq-q { grid-column: 2; margin: 2px 0 8px; font-size: 16.5px; line-height: 1.35; letter-spacing: -0.01em; }
.faq-a { grid-column: 2; font-size: 14.5px; }
.faq-a b { color: var(--text); font-weight: 600; }
@media (max-width: 720px) {
  .faq-item { grid-template-columns: 32px minmax(0, 1fr); column-gap: 10px; padding: 14px; }
  .faq-item::before { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; }
  .faq-q { font-size: 15.5px; }
  .sheet-grid .th { white-space: normal; line-height: 1.25; }
}
@media (max-width: 720px) {
  .faq-item::before { grid-row: 1; }
  .faq-q { align-self: center; margin-top: 0; }
  .faq-a { grid-column: 1 / -1; margin-top: 4px !important; }
}


/* ==========================================================
   Footer (redesign)
   ========================================================== */
.footer { border-top: 0; margin-top: 48px; padding: 0 0 28px; background: none; color: var(--muted); font-size: 14px; }
.f-cta {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 32px 36px; border-radius: 24px; color: #fff;
  background: radial-gradient(600px 300px at 100% 0%, rgba(255,255,255,.18), transparent 60%), linear-gradient(135deg, #2f6bff 0%, #1b3fa8 100%);
  box-shadow: 0 24px 48px -24px rgba(47, 107, 255, .55);
}
.f-cta::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background: linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px) 0 0 / 22px 22px, linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px) 0 0 / 22px 22px;
  mask-image: linear-gradient(90deg, transparent 30%, #000 100%); -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000 100%);
}
.f-cta-text { position: relative; z-index: 1; max-width: 560px; }
.f-cta-brand { color: #fff !important; font-size: 20px; font-weight: 700; }
.f-cta-brand .brand-mark rect { fill: #fff; }
.f-cta-brand .brand-mark ellipse, .f-cta-brand .brand-mark path { stroke: #2f6bff; }
.f-cta-text p { margin: 10px 0 18px; color: rgba(255,255,255,.85); font-size: 15px; line-height: 1.55; }
.f-cta-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.f-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: 14px;
  color: #fff !important; text-decoration: none; border: 1px solid rgba(255,255,255,.45); transition: background .15s, transform .15s;
}
.f-btn:hover { background: rgba(255,255,255,.12); transform: translateY(-1px); }
.f-btn-main { background: #fff; color: #1b3fa8 !important; border-color: #fff; }
.f-btn-main:hover { background: #eef3ff; }
.f-cta-art { position: relative; z-index: 1; width: 280px; height: auto; flex: none; }

.footer-grid { display: grid; grid-template-columns: 1fr 1fr 2.2fr; gap: 32px; padding: 40px 4px 32px; border-bottom: 1px solid var(--border); }
.f-title { display: flex; align-items: center; gap: 7px; margin: 0 0 14px; font-size: 12px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .07em; }
.f-globe { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 1.8; }
.f-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.footer .f-col a { color: var(--muted); text-decoration: none; transition: color .15s; }
.footer .f-col a:hover { color: var(--accent); }
.f-pop a { display: inline-flex; align-items: baseline; gap: 6px; }
.f-pop a::before { content: "›"; color: var(--accent); font-weight: 700; }
.lang-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px !important; }
.footer .lang-list a {
  display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.footer .lang-list a:hover { border-color: var(--accent); }
.lang-list .lc { flex: none; font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: var(--faint); background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
.footer .lang-list a[aria-current] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.lang-list a[aria-current] .lc { background: var(--accent); color: #fff; }

.f-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 0; padding: 20px 4px 0; border-top: 0; color: var(--faint); font-size: 13px; }
.f-top { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); transition: border-color .15s, transform .15s; }
.f-top:hover { border-color: var(--accent); transform: translateY(-2px); }
.f-top svg { width: 16px; height: 16px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 1080px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .f-lang, .f-pop { grid-column: auto; }
  .f-cta-art { width: 200px; }
}
@media (max-width: 720px) {
  .f-cta { flex-direction: column; align-items: flex-start; padding: 24px 20px; border-radius: 18px; }
  .f-cta-art { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 26px 18px; padding-top: 30px; }
  .f-pop, .f-lang { grid-column: 1 / -1; }
  .lang-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
[dir="rtl"] .f-cta::after { mask-image: linear-gradient(270deg, transparent 30%, #000 100%); -webkit-mask-image: linear-gradient(270deg, transparent 30%, #000 100%); }
[dir="rtl"] .f-cta-art { transform: scaleX(-1); }
[dir="rtl"] .f-pop a::before { content: "‹"; }
[dir="rtl"] .f-btn-main span { display: inline-block; transform: scaleX(-1); }

/* ---------- calculator directory (homepage, above the FAQ) ---------- */
.calc-dir { --g: var(--accent); }
.g-pipe { --g: #1a7fd6; }
.g-units { --g: #c2410c; }
.g-size { --g: #0e7490; }
.g-water { --g: #2f8cff; }
.g-gas { --g: #0fa89a; }
.g-oil { --g: #d9861c; }
.g-concrete { --g: #8f7f63; }
.g-shape { --g: #8b5cf6; }
.g-weight { --g: #5f6f86; }
.g-lab { --g: #1f9d5c; }
.g-chart { --g: #4f62ff; }
.cd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.cd-head .lead { max-width: 720px; margin-bottom: 14px; }
.cd-all {
  flex: none; display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; padding: 8px 14px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--accent); font-size: 13.5px; font-weight: 700; text-decoration: none; transition: border-color .15s, background .15s;
}
.cd-all:hover { border-color: var(--accent); background: var(--accent-soft); }

.cd-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.cd-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 8px 6px 10px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--g) 28%, var(--border)); background: color-mix(in srgb, var(--g) 7%, var(--surface));
  color: var(--text); font-size: 13px; font-weight: 600; text-decoration: none; transition: border-color .15s, background .15s, transform .15s;
}
.cd-chip:hover { border-color: var(--g); background: color-mix(in srgb, var(--g) 14%, var(--surface)); transform: translateY(-1px); }
.cd-chip svg { width: 15px; height: 15px; }
.cd-chip .cd-n { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, var(--g) 16%, transparent); color: var(--g); font-size: 11.5px; text-align: center; }

.calc-dir svg { fill: none; stroke: var(--g); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.cd-group { scroll-margin-top: 80px; }
.cd-group + .cd-group { margin-top: 22px; }
.cd-gname { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.cd-gname::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, color-mix(in srgb, var(--g) 35%, var(--border)), transparent); }
[dir="rtl"] .cd-gname::after { background: linear-gradient(-90deg, color-mix(in srgb, var(--g) 35%, var(--border)), transparent); }
.cd-gic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--g) 15%, transparent); }
.cd-gic svg { width: 17px; height: 17px; }
.cd-gname .cd-n { font-size: 12px; font-weight: 600; color: var(--muted); }

.cd-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.cd-card {
  position: relative; height: 100%; display: flex; align-items: flex-start; gap: 13px; padding: 14px 38px 14px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); text-decoration: none; overflow: hidden;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.cd-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .18s;
  background: radial-gradient(260px 120px at 0% 0%, color-mix(in srgb, var(--g) 13%, transparent), transparent 70%);
}
.cd-card:hover, .cd-card:focus-visible { border-color: color-mix(in srgb, var(--g) 60%, var(--border)); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.cd-card:hover::before, .cd-card:focus-visible::before { opacity: 1; }
.cd-ic {
  position: relative; flex: none; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--g) 13%, var(--surface)); border: 1px solid color-mix(in srgb, var(--g) 22%, transparent);
  transition: transform .18s;
}
.cd-ic svg { width: 24px; height: 24px; }
.cd-card:hover .cd-ic { transform: scale(1.06) rotate(-3deg); }
.cd-txt { position: relative; display: grid; gap: 4px; min-width: 0; }
.cd-t { font-weight: 700; font-size: 14.5px; line-height: 1.3; color: var(--text); }
.cd-d {
  font-size: 13px; line-height: 1.45; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cd-go {
  position: absolute; right: 14px; top: 50%; translate: 0 -50%; font-weight: 700; color: var(--g);
  opacity: .45; transition: opacity .18s, transform .18s;
}
.cd-card:hover .cd-go { opacity: 1; transform: translateX(3px); }
[dir="rtl"] .cd-card { padding: 14px 14px 14px 38px; }
[dir="rtl"] .cd-go { right: auto; left: 14px; transform: scaleX(-1); }
[dir="rtl"] .cd-card:hover .cd-go { transform: scaleX(-1) translateX(3px); }

@media (max-width: 720px) {
  .cd-head { flex-direction: column; gap: 0; }
  .cd-all { margin: 0 0 16px; }
  .cd-grid { grid-template-columns: 1fr; }
  .cd-jump { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .cd-jump::-webkit-scrollbar { display: none; }
  .cd-chip { flex: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cd-card, .cd-ic, .cd-go, .cd-chip { transition: none; }
  .cd-card:hover, .cd-chip:hover { transform: none; }
  .cd-card:hover .cd-ic { transform: none; }
}
.vol-table.wrap td { white-space: normal; font-family: var(--font); font-size: 13.5px; min-width: 120px; }
.vol-table.wrap td code { white-space: nowrap; }
