/* Nomogram catalogue and dedicated interactive pages (/tools/nomogram-lab/). */

/* This stylesheet is loaded only on the lab page, so the detail shell can use
   the full content width without changing other fixed pages. */
.dads-detail .dads-page {
  max-width: 80rem;
}

@media (min-width: 67.5rem) {
  .dads-detail .dads-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.nomogram-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(16rem, 0.8fr);
  gap: 2rem;
  align-items: end;
  overflow: hidden;
  margin: -0.25rem -0.25rem 2rem;
  padding: clamp(1.5rem, 4vw, 3.25rem);
  border-radius: 1.25rem;
  color: #f7fbff;
  background:
    radial-gradient(circle at 88% 14%, rgba(72, 210, 255, 0.24), transparent 28%),
    linear-gradient(135deg, #071827 0%, #0b2d48 52%, #124763 100%);
  box-shadow: 0 24px 60px rgba(7, 24, 39, 0.2);
}

.nomogram-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 1px, transparent 1px);
  background-size: 2rem 2rem;
  mask-image: linear-gradient(90deg, #000, transparent 86%);
}

.nomogram-hero__copy {
  max-width: 48rem;
}

.nomogram-kicker,
.nomogram-section-label {
  margin: 0 0 0.45rem;
  font-family: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.4;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.nomogram-kicker {
  color: #78ddff;
}

.nomogram-hero h2 {
  max-width: 13em;
  margin: 0;
  color: #ffffff;
  font-size: clamp(1.8rem, 4vw, 3.25rem);
  line-height: 1.16;
  letter-spacing: -0.04em;
}

.nomogram-hero__copy > p:last-child {
  max-width: 44rem;
  margin: 1.15rem 0 0;
  color: #dceef7;
  font-size: clamp(0.95rem, 1.5vw, 1.08rem);
  line-height: 1.9;
}

.nomogram-hero__facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0;
  padding: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 1rem;
  background: rgba(4, 20, 33, 0.52);
  backdrop-filter: blur(10px);
}

.nomogram-hero__facts > div {
  min-width: 0;
  padding: 0.7rem 0.45rem;
  text-align: center;
}

.nomogram-hero__facts dt {
  color: #9ec3d5;
  font-size: 0.68rem;
  font-weight: 650;
}

.nomogram-hero__facts dd {
  margin: 0.25rem 0 0;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 750;
  white-space: nowrap;
}

.nomogram-hero--detail h2 {
  max-width: 15em;
}

.nomogram-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
  margin: 1.25rem 0 2.5rem;
  padding: 0;
  list-style: none;
}

.nomogram-catalog > li {
  min-width: 0;
}

.dads-detail .nomogram-card {
  display: flex;
  height: 100%;
  min-height: 17rem;
  flex-direction: column;
  gap: 0.75rem;
  border: 1px solid #cad8de;
  border-radius: 1rem;
  padding: 1.25rem;
  color: #142536;
  background:
    linear-gradient(135deg, rgba(6, 168, 199, 0.08), transparent 48%),
    #fbfaf3;
  box-shadow: 0 12px 28px rgba(10, 38, 55, 0.08);
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.dads-detail .nomogram-card:hover {
  border-color: #2797b4;
  color: #142536;
  box-shadow: 0 18px 36px rgba(10, 38, 55, 0.14);
  transform: translateY(-2px);
}

.nomogram-card__kind {
  color: #126a8a;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.nomogram-card > strong {
  font-size: 1.25rem;
  line-height: 1.35;
}

.nomogram-card > code {
  display: block;
  overflow: hidden;
  border: 1px solid #d7e1e4;
  border-radius: 0.55rem;
  padding: 0.6rem 0.7rem;
  color: #16384b;
  background: #ffffff;
  font-size: 0.76rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.nomogram-card__summary {
  color: #536676;
  font-size: 0.85rem;
  line-height: 1.75;
}

.nomogram-card__action {
  margin-top: auto;
  color: #0d6f8f;
  font-size: 0.82rem;
  font-weight: 800;
}

.nomogram-lab {
  --nomogram-navy: #071827;
  --nomogram-navy-soft: #123149;
  --nomogram-blue: #126a8a;
  --nomogram-cyan: #06a8c7;
  --nomogram-orange: #e3532f;
  --nomogram-paper: #fbfaf3;
  --nomogram-paper-deep: #f0eee2;
  --nomogram-ink: #142536;
  --nomogram-muted: #536676;
  --nomogram-border: #cad5da;
  overflow: hidden;
  margin: 2rem 0;
  border: 1px solid rgba(12, 55, 78, 0.2);
  border-radius: 1.35rem;
  color: var(--nomogram-ink);
  background: var(--nomogram-paper);
  box-shadow: 0 22px 55px rgba(10, 38, 55, 0.13);
}

.nomogram-lab__topbar {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem clamp(1rem, 3vw, 2rem);
  color: #f4fbff;
  background: var(--nomogram-navy);
}

.nomogram-lab__topbar h2,
.nomogram-stage h2,
.nomogram-controls h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.35;
}

.nomogram-lab__topbar .nomogram-section-label {
  color: #78dfff;
}

.nomogram-lab__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
}

.nomogram-share {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.nomogram-share__status {
  min-width: 6.5em;
  color: #a8e8bc;
  font-size: 0.78rem;
}

.nomogram-button,
.nomogram-presets button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.nomogram-button {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.68rem 1rem;
  font-size: 0.82rem;
  font-weight: 750;
}

.nomogram-button--quiet {
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.nomogram-button--quiet:hover {
  border-color: #76ddff;
  color: #ffffff;
  background: rgba(118, 221, 255, 0.13);
}

.nomogram-lab .nomogram-button--back {
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #dff6ff;
  background: transparent;
  text-decoration: none;
}

.nomogram-lab .nomogram-button--back:hover {
  border-color: #76ddff;
  color: #ffffff;
  background: rgba(118, 221, 255, 0.1);
}

.nomogram-button--reset {
  width: 100%;
  border: 1px solid var(--nomogram-border);
  color: var(--nomogram-navy-soft);
  background: transparent;
}

.nomogram-button--reset:hover {
  border-color: var(--nomogram-blue);
  background: #eef7f9;
}

.nomogram-workspace {
  display: grid;
  grid-template-columns: minmax(18rem, 0.78fr) minmax(34rem, 1.7fr);
  min-height: 43rem;
}

.nomogram-controls {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: clamp(1rem, 2.5vw, 1.7rem);
  border-right: 1px solid var(--nomogram-border);
  background: #f4f5ef;
}

.nomogram-model-summary {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--nomogram-border);
}

.nomogram-controls .nomogram-section-label,
.nomogram-stage .nomogram-section-label {
  color: var(--nomogram-blue);
}

.nomogram-model-summary > p:not(.nomogram-section-label):not(.nomogram-formula) {
  margin: 0.55rem 0 0;
  color: var(--nomogram-muted);
  font-size: 0.85rem;
  line-height: 1.7;
}

.nomogram-formula {
  display: inline-flex;
  max-width: 100%;
  margin: 0.85rem 0 0;
  border: 1px solid #b9ccd2;
  border-radius: 0.55rem;
  padding: 0.48rem 0.72rem;
  color: #08354c;
  background: #e9f4f5;
  font-family: "Cambria Math", Cambria, Georgia, serif;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.nomogram-field,
.nomogram-input {
  display: grid;
  gap: 0.45rem;
}

.nomogram-field > label,
.nomogram-presets legend {
  color: var(--nomogram-navy-soft);
  font-size: 0.78rem;
  font-weight: 750;
}

.nomogram-field select,
.nomogram-input__number input {
  width: 100%;
  border: 1px solid #aebfc6;
  border-radius: 0.62rem;
  color: var(--nomogram-ink);
  background: #ffffff;
  font: inherit;
}

.nomogram-field select {
  min-height: 2.65rem;
  padding: 0.5rem 2rem 0.5rem 0.72rem;
}

.nomogram-field__hint {
  color: var(--nomogram-muted);
  font-size: 0.68rem;
  line-height: 1.5;
}

.nomogram-inputs {
  display: grid;
  gap: 0.72rem;
}

.nomogram-input {
  padding: 0.85rem;
  border: 1px solid var(--nomogram-border);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.72);
}

.nomogram-input--result {
  border-color: rgba(227, 83, 47, 0.45);
  background: #fff4ee;
}

.nomogram-input__heading {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.nomogram-input__heading label {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  font-size: 0.78rem;
  font-weight: 650;
}

.nomogram-input__heading label strong {
  color: var(--nomogram-blue);
  font-family: "Cambria Math", Cambria, Georgia, serif;
  font-size: 1rem;
}

.nomogram-input__role {
  border-radius: 999px;
  padding: 0.18rem 0.48rem;
  color: #205467;
  background: #e1f1f3;
  font-size: 0.62rem;
  font-weight: 750;
}

.nomogram-input--result .nomogram-input__role {
  color: #8e3119;
  background: #ffdcd0;
}

.nomogram-input input[type="range"] {
  width: 100%;
  margin: 0.15rem 0;
  accent-color: var(--nomogram-cyan);
}

.nomogram-input input[type="range"]:disabled {
  accent-color: var(--nomogram-orange);
  opacity: 0.75;
}

.nomogram-input__number {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.nomogram-input__number input {
  min-width: 0;
  min-height: 2.45rem;
  border-radius: 0.62rem 0 0 0.62rem;
  padding: 0.42rem 0.62rem;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.83rem;
}

.nomogram-input__number input[readonly] {
  color: #8e3119;
  background: #fffaf7;
  font-weight: 750;
}

.nomogram-input__number input[aria-invalid="true"] {
  border-color: #c7351f;
  outline: 2px solid rgba(199, 53, 31, 0.15);
}

.nomogram-input__number span {
  display: grid;
  place-items: center;
  min-width: 3.1rem;
  border: 1px solid #aebfc6;
  border-left: 0;
  border-radius: 0 0.62rem 0.62rem 0;
  padding: 0.35rem 0.55rem;
  color: var(--nomogram-muted);
  background: #e8eeef;
  font-size: 0.72rem;
  font-weight: 700;
}

.nomogram-presets {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.nomogram-presets__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.nomogram-presets button {
  border: 1px solid var(--nomogram-border);
  border-radius: 999px;
  padding: 0.4rem 0.62rem;
  color: #26485b;
  background: #ffffff;
  font-size: 0.68rem;
  font-weight: 650;
}

.nomogram-presets button:hover {
  border-color: var(--nomogram-blue);
  color: var(--nomogram-blue);
  background: #eef9fa;
}

.nomogram-stage {
  min-width: 0;
  padding: clamp(1rem, 3vw, 2rem);
  background:
    linear-gradient(rgba(11, 67, 91, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 67, 91, 0.03) 1px, transparent 1px),
    var(--nomogram-paper);
  background-size: 1.5rem 1.5rem;
}

.nomogram-stage__heading {
  display: flex;
  gap: 1rem;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.nomogram-stage__hint {
  margin: 0;
  color: var(--nomogram-muted);
  font-size: 0.72rem;
}

.nomogram-stage__hint span {
  color: var(--nomogram-cyan);
}

.nomogram-canvas-wrap {
  overflow: hidden;
  border: 1px solid #bec9c8;
  border-radius: 1rem;
  background: #fffef9;
  box-shadow: inset 0 0 0 5px rgba(226, 229, 216, 0.5), 0 14px 30px rgba(20, 37, 54, 0.08);
}

.nomogram-canvas {
  display: block;
  width: 100%;
  height: auto;
  min-height: 22rem;
  color: var(--nomogram-ink);
  user-select: none;
}

.nomogram-svg-grid line {
  stroke: #d9ddd5;
  stroke-dasharray: 2 7;
  stroke-width: 1;
}

.nomogram-axis__rule {
  stroke: #17394c;
  stroke-width: 2.1;
}

.nomogram-axis__rule--diagonal {
  stroke: #5b7580;
  stroke-width: 2.4;
}

.nomogram-axis__tick {
  stroke: #49616c;
  stroke-width: 1.25;
}

.nomogram-axis__tick-label,
.nomogram-axis__unit,
.nomogram-marker__label {
  font-family: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.nomogram-axis__tick-label {
  fill: #425a65;
  font-size: 11px;
}

.nomogram-axis__tick-label--diagonal {
  font-size: 10px;
}

.nomogram-axis__title {
  fill: #0c344a;
  font-family: "Cambria Math", Cambria, Georgia, serif;
  font-size: 20px;
  font-weight: 700;
}

.nomogram-axis__title--diagonal {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
}

.nomogram-axis__unit {
  fill: #637681;
  font-size: 10px;
}

.nomogram-isopleth {
  stroke: var(--nomogram-orange);
  stroke-linecap: round;
  stroke-width: 4;
  filter: drop-shadow(0 2px 2px rgba(131, 41, 19, 0.2));
}

.nomogram-marker__halo {
  fill: #fffef9;
  stroke-width: 2;
}

.nomogram-marker--input .nomogram-marker__halo {
  stroke: rgba(6, 168, 199, 0.35);
}

.nomogram-marker--input .nomogram-marker__shape {
  fill: var(--nomogram-cyan);
  stroke: #075b70;
  stroke-width: 2;
}

.nomogram-marker--input {
  cursor: ns-resize;
  touch-action: none;
}

.nomogram-marker--result .nomogram-marker__halo {
  stroke: rgba(227, 83, 47, 0.35);
}

.nomogram-marker--result .nomogram-marker__shape {
  fill: var(--nomogram-orange);
  stroke: #892f19;
  stroke-width: 2;
}

.nomogram-marker__label {
  fill: #0d2d40;
  font-size: 11px;
  font-weight: 750;
  paint-order: stroke;
  stroke: #fffef9;
  stroke-linejoin: round;
  stroke-width: 4px;
}

.nomogram-lab--dragging .nomogram-canvas,
.nomogram-lab--dragging .nomogram-marker--input {
  cursor: grabbing;
}

.nomogram-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-top: 0.75rem;
  color: var(--nomogram-muted);
  font-size: 0.7rem;
}

.nomogram-legend span {
  display: inline-flex;
  gap: 0.38rem;
  align-items: center;
}

.nomogram-legend__dot {
  display: inline-block;
  width: 0.62rem;
  height: 0.62rem;
  border: 1px solid currentColor;
  background: currentColor;
}

.nomogram-legend__dot--input {
  border-radius: 50%;
  color: var(--nomogram-cyan);
}

.nomogram-legend__dot--result {
  color: var(--nomogram-orange);
  transform: rotate(45deg);
}

.nomogram-legend__line {
  width: 1.25rem;
  height: 0;
  border-top: 3px solid var(--nomogram-orange);
}

.nomogram-result {
  display: grid;
  grid-template-columns: minmax(10rem, auto) minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
  border: 1px solid rgba(227, 83, 47, 0.32);
  border-radius: 0.95rem;
  padding: 0.9rem 1rem;
  background: #fff5ef;
}

.nomogram-result > div {
  display: grid;
  gap: 0.15rem;
}

.nomogram-result__label {
  color: #7e3c28;
  font-size: 0.7rem;
  font-weight: 750;
}

.nomogram-result__value {
  color: #822d17;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: clamp(1.25rem, 3vw, 1.85rem);
  font-weight: 800;
  line-height: 1.2;
}

.nomogram-result__reading {
  min-width: 0;
  margin: 0;
  color: #5f433a;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.nomogram-notice {
  min-height: 1.4em;
  margin: 0.55rem 0 0;
  font-size: 0.72rem;
}

.nomogram-notice[data-tone="warning"] {
  color: #8a5300;
}

.nomogram-notice[data-tone="error"] {
  color: #b42318;
}

.nomogram-explanation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid #244255;
  background: #244255;
}

.nomogram-explanation > div {
  display: grid;
  gap: 0.35rem;
  padding: 1rem clamp(1rem, 3vw, 1.75rem);
  color: #eaf5f8;
  background: var(--nomogram-navy-soft);
}

.nomogram-explanation span {
  color: #82cbdc;
  font-size: 0.67rem;
  font-weight: 750;
}

.nomogram-explanation strong {
  font-size: 0.78rem;
  line-height: 1.65;
}

.nomogram-noscript {
  margin: 1rem 0;
  border: 1px solid #d99b20;
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
  color: #704500;
  background: #fff7df;
}

.nomogram-related {
  margin: 3rem 0 1rem;
  border-top: 1px solid #d5e0e4;
  padding-top: 1.5rem;
}

.nomogram-related h2 {
  margin-top: 0;
}

.nomogram-related ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nomogram-related a {
  display: grid;
  gap: 0.2rem;
  height: 100%;
  border: 1px solid #d3dfe3;
  border-radius: 0.75rem;
  padding: 0.8rem 0.9rem;
  color: #16384b;
  background: #f7faf9;
  font-weight: 750;
  text-decoration: none;
}

.nomogram-related a:hover {
  border-color: #2797b4;
  color: #0d6f8f;
}

.nomogram-related a span {
  color: #627684;
  font-size: 0.7rem;
  font-weight: 600;
}

.nomogram-card:focus-visible,
.nomogram-related a:focus-visible,
.nomogram-lab a:focus-visible,
.nomogram-lab button:focus-visible,
.nomogram-lab select:focus-visible,
.nomogram-lab input:focus-visible {
  outline: 3px solid #f0a52d;
  outline-offset: 2px;
}

@media (max-width: 70rem) {
  .nomogram-workspace {
    grid-template-columns: 1fr;
  }

  .nomogram-controls {
    border-right: 0;
    border-bottom: 1px solid var(--nomogram-border);
  }

  .nomogram-inputs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 48rem) {
  .nomogram-hero {
    grid-template-columns: 1fr;
  }

  .nomogram-hero__facts {
    max-width: 26rem;
  }

  .nomogram-lab__topbar,
  .nomogram-stage__heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .nomogram-share {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .nomogram-lab__actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .nomogram-button--quiet,
  .nomogram-button--back {
    width: 100%;
  }

  .nomogram-inputs {
    grid-template-columns: 1fr;
  }

  .nomogram-canvas {
    min-height: 17rem;
  }

  .nomogram-result,
  .nomogram-explanation {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 34rem) {
  .nomogram-hero {
    margin-inline: 0;
    padding: 1.3rem;
  }

  .nomogram-hero__facts {
    grid-template-columns: 1fr;
  }

  .nomogram-hero__facts > div {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    justify-content: space-between;
    padding: 0.38rem 0.62rem;
    text-align: left;
  }

  .nomogram-stage {
    padding-inline: 0.7rem;
  }

  .nomogram-axis__tick-label {
    font-size: 9px;
  }
}

@media (forced-colors: active) {
  .nomogram-hero,
  .nomogram-lab,
  .nomogram-lab__topbar,
  .nomogram-card,
  .nomogram-related a,
  .nomogram-controls,
  .nomogram-stage,
  .nomogram-explanation,
  .nomogram-explanation > div {
    forced-color-adjust: auto;
  }

  .nomogram-isopleth,
  .nomogram-axis__rule,
  .nomogram-axis__tick,
  .nomogram-marker__shape {
    stroke: CanvasText;
  }
}

@media print {
  .nomogram-lab__topbar,
  .nomogram-controls,
  .nomogram-explanation,
  .nomogram-legend,
  .nomogram-notice {
    display: none;
  }

  .nomogram-workspace {
    display: block;
    min-height: 0;
  }

  .nomogram-stage,
  .nomogram-canvas-wrap {
    border: 0;
    box-shadow: none;
  }
}
