/* This code is part of a computer software VLabs developed and fully owned
   by Dr. Red Oy. All rights reserved.
   (c) Dr. Red Oy, 2021-2026

   The UD v2 site (ud/v2/base_v2.html) and its design tool (ud/v2/tools.html).
   Colours: the brand only (red #b03a2e, red-dark #8a2a20, gray #787878, gray-dark #343a40,
   gray-light #f8f9fa), the chart palette of ud_v2_common.js and one green for "regenerated" in
   the SMB flow sheet (--ud-ok #2e7d32). */

.ud-v2 {
  --ud-red: #b03a2e;
  --ud-red-dark: #8a2a20;
  --ud-gray: #787878;
  --ud-gray-dark: #343a40;
  --ud-gray-light: #f8f9fa;
  --ud-line: #e5e5e5;
  --ud-comp1: #2f6f9f;
  --ud-comp2: #b03a2e;
  --ud-ok: #2e7d32;
  background-color: #f8f9fa;
}

.ud-v2 [hidden] { display: none !important; }

.ud-v2-skip:focus { position: absolute; top: .5rem; left: .5rem; z-index: 2000;
  background: #fff; color: var(--ud-red-dark); padding: .5rem .75rem; border-radius: 4px; }

/* the nav: dropdown toggles are buttons */
.ud-v2 .vl-navbar .dropdown-toggle { background: none; border: 0; }
.ud-v2 .vl-navbar .dropdown-item.active,
.ud-v2 .vl-navbar .dropdown-item:active { background-color: var(--ud-red); color: #fff; }

/* the strip under the nav, as on the old UD pages, without a heading of its own */
.ud-v2-strip {
  background-color: var(--ud-gray-light);
  border-bottom: 1px solid #f8f9fa;
  padding: 1.1rem 0;
  text-align: center;
}
.ud-v2-strip-title {
  color: var(--ud-red);
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.ud-v2-strip-sub {
  color: var(--ud-gray-dark);
  font-weight: 300;
  margin-left: .75rem;
}

.ud-v2 .ud-content-wrapper {
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 15px rgba(52, 58, 64, 0.06);
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}
.ud-v2 h1 { color: var(--ud-gray-dark); font-size: 1.6rem; font-weight: 600; margin-bottom: .75rem; }
.ud-v2 .ud-content-wrapper a:not(.btn) { color: var(--ud-red-dark); }

.ud-v2 .DrRedButton {
  background-color: var(--ud-red);
  border-color: var(--ud-red);
  color: #fff;
}
.ud-v2 .DrRedButton:hover,
.ud-v2 .DrRedButton:focus { background-color: var(--ud-red-dark); border-color: var(--ud-red-dark); color: #fff; }
.ud-v2-btn-outline {
  border: 1px solid var(--ud-red);
  color: var(--ud-red-dark);
  background: #fff;
}
.ud-v2-btn-outline:hover:not(:disabled),
.ud-v2-btn-outline:focus { background: var(--ud-red); color: #fff; border-color: var(--ud-red); }
.ud-v2-btn-outline:disabled { border-color: var(--ud-line); color: var(--ud-gray); }

.ud-v2-powered { text-transform: uppercase; font-weight: 700; color: var(--ud-gray); font-size: .85rem; margin-bottom: .5rem; }

.ud-v2-card { border: 0; box-shadow: 0 1px 6px rgba(52, 58, 64, 0.1); }
.ud-v2-home .lead { max-width: 52rem; }
.ud-v2-home p { max-width: 52rem; }

.ud-v2-further-reading { margin-top: 2rem; }
.ud-v2-further-reading h2 { font-size: 1.15rem; }
.ud-v2-open-access { color: var(--ud-gray); }

/* ------------------------------------------------------------------ design tool */
.ud-v2-wide { max-width: 1440px; }
@media (min-width: 992px) {
  .ud-v2-wide .ud-content-wrapper { padding: 1.75rem 2rem; }
}
@media (max-width: 575.98px) {
  .ud-v2 .ud-content-wrapper { padding: 1rem .75rem; margin-top: .75rem; border-radius: 0; }
  .ud-v2-wide { padding-left: 0; padding-right: 0; }
  .ud-v2-strip { padding: .7rem 0; }
  .ud-v2-strip-sub { display: block; margin: 0; font-size: .85rem; }
}

.ud-v2-intro { color: var(--ud-gray-dark); max-width: 62rem; margin-bottom: 1.25rem; }

.ud-v2-h2 { font-size: 1.05rem; font-weight: 600; color: var(--ud-gray-dark); margin: 0 0 .6rem 0; }
.ud-v2-h3 { font-size: .95rem; font-weight: 600; color: var(--ud-gray-dark); margin: 1rem 0 .4rem 0; }
.ud-v2-h3:first-child { margin-top: 0; }

.ud-v2-banner {
  border-left: 4px solid var(--ud-red);
  background: var(--ud-gray-light);
  color: var(--ud-red-dark);
  padding: .6rem .9rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.ud-v2-panel {
  border: 1px solid var(--ud-line);
  border-radius: 8px;
  padding: .9rem 1rem 1rem;
  margin-bottom: 1rem;
  background: #fff;
}

/* the input grid: a head column and two value columns (component 1, component 2) */
.ud-v2-grid {
  display: grid;
  grid-template-columns: minmax(7.5rem, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
  column-gap: .5rem;
  row-gap: .45rem;
  align-items: start;
}
.ud-v2-row { display: contents; }
.ud-v2-span2 { grid-column: span 2; }
.ud-v2-colhead { font-size: .8rem; font-weight: 600; color: var(--ud-gray); padding-left: .2rem; }
.ud-v2-head { padding-top: .1rem; line-height: 1.2; min-width: 0; }
.ud-v2-sym { font-size: 1.05rem; cursor: help; border-radius: 3px; }
.ud-v2-sym:focus-visible, .ud-v2-defined:focus-visible { outline: 2px solid var(--ud-red); outline-offset: 2px; }
.ud-v2-unit {
  font-size: .78rem;
  color: var(--ud-gray-dark);
  background: var(--ud-gray-light);
  border: 1px solid var(--ud-line);
  border-radius: 3px;
  padding: 0 .3rem;
  margin-left: .2rem;
  white-space: nowrap;
  vertical-align: 1px;
}
.ud-v2-unit:empty { display: none; }
.ud-v2-label { font-size: .76rem; color: var(--ud-gray); margin-top: .1rem; }
.ud-v2-label-solo { font-size: .85rem; color: var(--ud-gray-dark); margin-top: .3rem; }
.ud-v2-cell { min-width: 0; }
.ud-v2-input { font-variant-numeric: tabular-nums; }
.ud-v2 .form-control:focus,
.ud-v2 .form-check-input:focus { border-color: var(--ud-red); box-shadow: 0 0 0 .2rem rgba(176, 58, 46, .2); }
.ud-v2 .form-check-input:checked { background-color: var(--ud-red); border-color: var(--ud-red); }
.ud-v2 .ud-v2-input.is-invalid {
  border-color: var(--ud-red);
  background-image: none;
  padding-right: .5rem;
  box-shadow: inset 0 0 0 1px var(--ud-red);
}
.ud-v2-err { color: var(--ud-red-dark); font-size: .78rem; line-height: 1.25; margin-top: .15rem; }
.ud-v2-err:empty { display: none; }
.ud-v2-time { font-size: .8rem; color: var(--ud-gray-dark); margin-top: .2rem; }
.ud-v2 input:disabled { background-color: var(--ud-gray-light); color: var(--ud-gray); }

/* segmented radio buttons */
.ud-v2-seg .btn {
  border: 1px solid var(--ud-red);
  color: var(--ud-red-dark);
  background: #fff;
  font-size: .82rem;
}
.ud-v2-seg .btn-check:checked + .btn { background: var(--ud-red); color: #fff; }
.ud-v2-seg .btn-check:focus-visible + .btn { box-shadow: 0 0 0 .2rem rgba(176, 58, 46, .25); }
.ud-v2-seg .btn-check:disabled + .btn { border-color: var(--ud-line); color: var(--ud-gray); opacity: 1; }

/* one cut or two */
.ud-v2-tool:not(.ud-v2-has-two-cuts) .ud-v2-two-cut { display: none !important; }
.ud-v2-has-two-cuts .ud-v2-one-cut { display: none !important; }
.ud-v2-no-column .ud-v2-needs-column { display: none !important; }

/* batch or SMB (the Batch | SMB switch next to the title) */
.ud-v2-tool:not(.ud-v2-mode-smb) .ud-v2-smb-only { display: none !important; }
.ud-v2-mode-smb .ud-v2-batch-only { display: none !important; }
.ud-v2-titlebar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; margin-bottom: .75rem; }
.ud-v2-titlebar h1 { margin-bottom: 0; }
.ud-v2-limit { display: block; font-size: .8rem; color: var(--ud-gray-dark); margin-top: .2rem; }
.ud-v2-limit:empty { display: none; }
.ud-v2-limit-off { color: var(--ud-red-dark); font-weight: 600; }
#v2SmbTable { max-width: 46rem; }
/* the SMB flow sheet: an inline SVG drawn by ud_v2_tools.js (renderFlowsheet) */
.ud-v2-flowsheet svg { display: block; width: 100%; height: auto; max-width: 900px; }
/* the two-row layout of narrow cards: not larger than about 1.2 times its own units */
.ud-v2-flowsheet svg.ud-v2-fs-narrow { max-width: 420px; margin: 0 auto; }
.ud-v2-fs-ok { fill: var(--ud-ok); }
.ud-v2-fs-off { fill: var(--ud-red-dark); font-weight: 600; }
.ud-v2-fs-box-off { stroke: var(--ud-red-dark); stroke-width: 2.5; }

/* the charts and results */
.ud-v2-tool .ud-v2-card {
  border: 1px solid var(--ud-line);
  border-radius: 8px;
  padding: .9rem 1rem 1rem;
  margin-bottom: 1rem;
  background: #fff;
  box-shadow: none;
}
.ud-v2-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: .5rem; }
.ud-v2-card-head .ud-v2-h2 { margin: 0; }
.ud-v2-stale { font-size: .8rem; color: var(--ud-red-dark); }
.ud-v2-is-stale canvas, .ud-v2-is-stale .ud-v2-table, .ud-v2-is-stale .ud-v2-flowsheet { opacity: .35; }

.ud-v2-chartbox { position: relative; width: 100%; }
.ud-v2-chartbox-region { height: 340px; }
.ud-v2-chartbox-chrom { height: 330px; }
@media (max-width: 575.98px) {
  .ud-v2-chartbox-region { height: 290px; }
  .ud-v2-chartbox-chrom { height: 280px; }
}

.ud-v2-legend { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; font-size: .8rem; color: var(--ud-gray-dark); }
.ud-v2-legend li { display: flex; align-items: center; gap: .4rem; }
.ud-v2-key { display: inline-block; width: 18px; height: 12px; flex: none; }
.ud-v2-key-region { background: rgba(176, 58, 46, 0.12); border: 2px solid #8a2a20; }
.ud-v2-key-complete { border: 2px dashed #343a40; height: 12px; }
.ud-v2-key-tip { width: 10px; height: 10px; background: #8a2a20; transform: rotate(45deg); margin: 0 4px; }
.ud-v2-key-touch { width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 12px solid #343a40; }
.ud-v2-key-point { width: 13px; height: 13px; border-radius: 50%; background: #343a40; box-shadow: 0 0 0 2px #fff, 0 0 0 3px #343a40; margin: 0 2px; }
.ud-v2-key-c1 { height: 3px; background: var(--ud-comp1); }
.ud-v2-key-c2 { height: 3px; background: var(--ud-comp2); }
.ud-v2-key-cut { width: 3px; height: 14px; background: #8a2a20; margin: 0 7px; }
.ud-v2-key-frac { background: linear-gradient(90deg, rgba(47, 111, 159, .18) 50%, rgba(176, 58, 46, .18) 50%); }
.ud-v2-key-waste { background: rgba(120, 120, 120, .25); }

.ud-v2-facts { font-size: .85rem; color: var(--ud-gray-dark); margin: .5rem 0 0; }
.ud-v2-facts:empty { display: none; }
.ud-v2-note { font-size: .8rem; color: var(--ud-gray); margin: .5rem 0 0; }

.ud-v2-badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 999px;
  border: 1px solid var(--ud-gray-dark);
  color: var(--ud-gray-dark);
  font-weight: 600;
  font-size: .85rem;
  margin-bottom: .5rem;
}
.ud-v2-badge-touch { background: var(--ud-red); border-color: var(--ud-red); color: #fff; }

.ud-v2-table { font-size: .85rem; margin-bottom: .25rem; }
#v2Performance { max-width: 46rem; }
.ud-v2-table th { font-weight: 500; color: var(--ud-gray-dark); }
.ud-v2-table thead th { font-weight: 600; vertical-align: bottom; }
.ud-v2-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ud-v2-table thead .ud-v2-num { white-space: normal; }
.ud-v2-sub { font-weight: 400; font-size: .75rem; color: var(--ud-gray); }
.ud-v2-table-sub th { font-weight: 600 !important; padding-top: .7rem; color: var(--ud-gray) !important; font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; }
.ud-v2-row-at > * { background: rgba(176, 58, 46, 0.08) !important; }
.ud-v2-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .25rem .75rem; font-size: .85rem; margin-bottom: .5rem; }
.ud-v2-dl dt { font-weight: 500; color: var(--ud-gray); }
.ud-v2-dl dd { margin: 0; color: var(--ud-gray-dark); min-width: 0; overflow-wrap: anywhere; }
.ud-v2-defined { border-bottom: 1px dotted var(--ud-gray); cursor: help; }
.ud-v2-unit-cell { color: var(--ud-gray); font-size: .78rem; }
#v2Thresholds .btn { font-size: .75rem; padding: .1rem .45rem; white-space: nowrap; }

.ud-v2 .tooltip { --bs-tooltip-bg: #343a40; --bs-tooltip-max-width: 320px; }
.ud-v2 .tooltip-inner { text-align: left; }

/* ------------------------------------------------------------------ content pages */
/* the lesson box of the worked examples (with Bootstrap's alert-light border shadow-sm) */
.ud-v2-lesson { border-left: 4px solid var(--ud-red) !important; }
/* wide display equations scroll on a phone instead of widening the page */
.ud-v2 mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
/* a note on pages whose content awaits the author's check (v2_draft_note) */
.ud-v2-draft-note {
  border: 1px dashed var(--ud-red-dark);
  border-left: 4px solid var(--ud-red-dark);
  background: var(--ud-gray-light);
  color: var(--ud-red-dark);
  font-weight: 600;
  padding: .5rem .8rem;
  margin: .25rem 0 1rem;
}
/* range sliders in the brand colour, not Bootstrap's blue */
.ud-v2 input[type="range"] { accent-color: var(--ud-red); }
.ud-v2 .form-range::-webkit-slider-thumb { background-color: var(--ud-red); }
.ud-v2 .form-range::-webkit-slider-thumb:active { background-color: var(--ud-red-dark); }
.ud-v2 .form-range::-moz-range-thumb { background-color: var(--ud-red); }
.ud-v2 .form-range:focus::-webkit-slider-thumb { box-shadow: 0 0 0 1px #fff, 0 0 0 .25rem rgba(176, 58, 46, .25); }
.ud-v2 .form-range:focus::-moz-range-thumb { box-shadow: 0 0 0 1px #fff, 0 0 0 .25rem rgba(176, 58, 46, .25); }
/* a visible track: Bootstrap's light track disappears on the gray boxes, leaving only the red thumb */
.ud-v2 .form-range::-webkit-slider-runnable-track { height: .4rem; background-color: rgba(120, 120, 120, .45); border-radius: .2rem; }
.ud-v2 .form-range::-webkit-slider-thumb { margin-top: -.3rem; }
.ud-v2 .form-range::-moz-range-track { height: .4rem; background-color: rgba(120, 120, 120, .45); border-radius: .2rem; }
/* a note or an error message in the brand colours (instead of Bootstrap's alert colours) */
.ud-v2-callout {
  background: var(--ud-gray-light);
  border-left: 4px solid var(--ud-red);
  color: var(--ud-gray-dark);
  padding: .6rem .9rem;
  margin: .75rem 0;
}
.ud-v2-callout-error { border-left-color: var(--ud-red-dark); color: var(--ud-red-dark); font-weight: 500; }
/* the design tool's per-product cut limits and the two parts of the operating point */
.ud-v2-key-line { height: 0; width: 14px; border-top: 3px solid #343a40; }
.ud-v2-key-dash { height: 0; width: 14px; border-top: 3px dashed #343a40; margin-left: -.3rem; }
.ud-v2-key-pt { width: 12px; height: 12px; border-radius: 50%; background: #343a40; border: 2px solid #343a40; }
.ud-v2-key-hollow { background: #ffffff; }
