/* Threefold Capital: the Financial Intelligence Studio (/calculators).

   Loaded only on the Studio's pages, after site.css, whose colours, type and square corners it
   uses. The working page is an analyst's sheet: assumptions in a column on the left, the figures
   they produce on the right, and the schedules, scenarios and downloads underneath. Rules are
   thin and corners square, as everywhere on the site; gold marks what can be acted on and the
   figures that matter most. */

/* ---------- The working area ---------- */

.studio {
  position: relative;
  padding-bottom: clamp(3rem, 7vw, 6rem);
}

.studio::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: var(--line);
}

.studio__wrap {
  display: grid;
  gap: clamp(2.5rem, 5vw, 4rem);
  padding-top: clamp(1.75rem, 4vw, 2.75rem);
}

.studio__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

.studio__tabs {
  display: flex;
  gap: 0.25rem;
  margin-right: auto;
}

.studio__tab {
  min-height: 2.75rem;
  padding: 0.5rem 0.9rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--stone);
  font: 500 1rem/1.2 var(--sans);
  cursor: pointer;
}

.studio__tab[aria-selected="true"] {
  border-bottom-color: var(--gold);
  color: var(--ivory);
}

.studio__modes {
  display: inline-flex;
  border: 1px solid var(--line-strong);
}

.studio__tabs + .studio__modes {
  margin-left: 0;
}

.studio__bar > .studio__modes:first-child {
  margin-right: auto;
}

.studio__mode {
  min-height: 2.5rem;
  padding: 0.45rem 0.95rem;
  border: 0;
  background: transparent;
  color: var(--stone);
  font: 500 0.875rem/1.2 var(--sans);
  cursor: pointer;
}

.studio__mode[aria-pressed="true"] {
  background: var(--gold-hi);
  color: var(--black);
}

.studio__btn {
  min-height: 2.75rem;
  padding: 0.55rem 1.05rem;
  border: 1px solid var(--gold-line);
  background: transparent;
  color: var(--ivory);
  font: 500 0.9375rem/1.2 var(--sans);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.studio__btn--quiet {
  border-color: var(--line-strong);
  color: var(--stone);
}

@media (hover: hover) {
  .studio__btn:hover,
  .studio__tab:hover,
  .studio__mode[aria-pressed="false"]:hover {
    border-color: var(--gold);
    color: var(--ivory);
  }
}

.studio__btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.studio__link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--gold-hi);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--gold-line);
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.studio button:focus-visible,
.studio a:focus-visible,
.studio input:focus-visible,
.studio select:focus-visible,
.studio summary:focus-visible,
.studio [tabindex]:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 2px;
}

html:not(.js) [data-needs-js] {
  display: none !important;
}

.studio__work {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2.5rem, 5vw, 3.5rem);
  align-items: start;
}

@media (min-width: 62rem) {
  .studio__work {
    grid-template-columns: minmax(19rem, 25rem) minmax(0, 1fr);
    column-gap: clamp(2.5rem, 4vw, 4.5rem);
  }
}

/* ---------- Inputs ---------- */

.studio__form {
  display: grid;
  gap: 2rem;
}

/* On a phone the results are below the inputs; this takes the visitor there */
.studio__formfoot {
  padding-top: 0.25rem;
}

@media (min-width: 62rem) {
  .studio__formfoot {
    display: none;
  }
}

.studio__group {
  display: grid;
  gap: 1.15rem;
  min-width: 0;
  margin: 0;
  padding: 1.1rem 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.studio__legend {
  float: left;
  width: 100%;
  margin-bottom: 0.15rem;
  padding: 0;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 1.1875rem;
  font-style: italic;
  line-height: 1.3;
}

.studio__legend + * {
  clear: both;
}

.studio__badge {
  margin-left: 0.4rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--line-strong);
  color: var(--mute);
  font: 500 0.6875rem/1.4 var(--sans);
  font-style: normal;
  letter-spacing: 0.04em;
  vertical-align: 0.2em;
}

.studio__group-note {
  color: var(--mute);
  font-size: 0.875rem;
  line-height: 1.55;
}

.studio[data-mode="standard"] [data-pro] {
  display: none;
}

.studio__field {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.studio__label {
  color: var(--on-navy);
  font-size: 0.9375rem;
  line-height: 1.35;
}

.studio__input {
  display: flex;
  align-items: center;
  min-height: 2.875rem;
  border: 1px solid var(--line-strong);
  background: var(--navy-deep);
  transition: border-color 0.2s ease;
}

.studio__input:focus-within {
  border-color: var(--gold);
}

.studio__input input,
.studio__input select,
.studio__rowtable input,
.studio__rowtable select {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 0;
  background: transparent;
  color: var(--ivory);
  font: 500 1.0625rem/1.2 var(--sans);
  font-variant-numeric: tabular-nums;
}

.studio__input input:focus,
.studio__input select:focus {
  outline: none;
}

.studio__input select {
  appearance: none;
  padding-right: 2.25rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: right 1.1rem center, right 0.8rem center;
  background-size: 0.3rem 0.3rem, 0.3rem 0.3rem;
  background-repeat: no-repeat;
  cursor: pointer;
}

.studio__input select option {
  background: var(--navy-deep);
  color: var(--ivory);
}

.studio__unit {
  flex: none;
  color: var(--mute);
  font-size: 0.9375rem;
}

.studio__unit--pre {
  padding-left: 0.75rem;
  margin-right: -0.55rem;
}

.studio__unit--post {
  padding-right: 0.75rem;
}

.studio__input--percent input,
.studio__input--years input,
.studio__input--months input {
  text-align: left;
}

.studio__input input[aria-invalid="true"] {
  color: var(--alert);
}

.studio__field:has([aria-invalid="true"]) .studio__input {
  border-color: var(--alert);
}

.studio__err {
  color: var(--alert);
  font-size: 0.875rem;
  line-height: 1.45;
}

.studio__help {
  color: var(--mute);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.studio__field.is-changed .studio__label::after {
  content: "Changed in this scenario";
  margin-left: 0.5rem;
  color: var(--gold);
  font-size: 0.75rem;
}

.studio__check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  color: var(--on-navy);
  cursor: pointer;
}

.studio__check input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--gold);
}

/* The slider follows the box: a fine rule with a square handle */
.studio__slider {
  width: 100%;
  height: 1.5rem;
  margin: -0.15rem 0 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.studio__slider::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--line-strong);
}

.studio__slider::-moz-range-track {
  height: 2px;
  background: var(--line-strong);
}

.studio__slider::-webkit-slider-thumb {
  width: 0.95rem;
  height: 0.95rem;
  margin-top: calc(-0.475rem + 1px);
  border: 0;
  background: var(--gold);
  appearance: none;
  -webkit-appearance: none;
}

.studio__slider::-moz-range-thumb {
  width: 0.95rem;
  height: 0.95rem;
  border: 0;
  border-radius: 0;
  background: var(--gold);
}

.studio__pro-note {
  padding: 0.8rem 1rem;
  border-left: 2px solid var(--gold);
  background: var(--navy-deep);
  color: var(--on-navy);
  font-size: 0.875rem;
  line-height: 1.55;
}

/* Lists: dated cash flows, groups of employees */
.studio__rows {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
  width: 100%;
  overflow-x: auto;
}

.studio__rowtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.studio__rowtable th {
  padding: 0 0.35rem 0.35rem;
  color: var(--mute);
  font-weight: 500;
  font-size: 0.75rem;
  text-align: left;
  white-space: nowrap;
}

.studio__rowtable td {
  padding: 0.2rem 0.2rem;
  vertical-align: middle;
}

.studio__rowtable input,
.studio__rowtable select {
  min-height: 2.5rem;
  border: 1px solid var(--line-strong);
  background: var(--navy-deep);
  font-size: 0.9375rem;
}

.studio__rowtable input[aria-invalid="true"] {
  border-color: var(--alert);
}

.studio__iconbtn {
  min-height: 2.5rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--mute);
  font: 500 0.8125rem/1 var(--sans);
  cursor: pointer;
}

/* A list stacks into labelled cards wherever it has too little room for its columns: on a phone,
   and in the narrow inputs column beside the results on a wide screen */
.studio__rows {
  container-type: inline-size;
  container-name: rows;
}

@container rows (max-width: 36rem) {
  .studio__rowtable thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .studio__rowtable,
  .studio__rowtable tbody,
  .studio__rowtable tr,
  .studio__rowtable td {
    display: block;
    width: 100%;
  }

  .studio__rowtable tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem 0.6rem;
    margin-bottom: 0.9rem;
    padding: 0.75rem 0 0.9rem;
    border-top: 1px solid var(--line);
  }

  .studio__rowtable td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.25rem;
    color: var(--mute);
    font-size: 0.75rem;
  }

  .studio__rowtable td.studio__rowact {
    display: flex;
    align-items: end;
  }

  .studio__rowtable td:first-child {
    grid-column: 1 / -1;
  }
}

@supports not (container-type: inline-size) {
  @media (max-width: 47.99rem) {
    .studio__rowtable thead {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
    }

    .studio__rowtable,
    .studio__rowtable tbody,
    .studio__rowtable tr,
    .studio__rowtable td {
      display: block;
      width: 100%;
    }

    .studio__rowtable tr {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0.5rem 0.6rem;
      margin-bottom: 0.9rem;
      padding: 0.75rem 0 0.9rem;
      border-top: 1px solid var(--line);
    }

    .studio__rowtable td::before {
      content: attr(data-label);
      display: block;
      margin-bottom: 0.25rem;
      color: var(--mute);
      font-size: 0.75rem;
    }

    .studio__rowtable td.studio__rowact {
      display: flex;
      align-items: end;
    }
  }
}

/* ---------- Results ---------- */

.studio__out {
  display: grid;
  gap: 1.75rem;
  min-width: 0;
}

.studio__out:focus {
  outline: none;
}

.studio__out.is-stale .studio__kpis,
.studio__out.is-stale .studio__words,
.studio__out.is-stale .studio__charts {
  opacity: 0.35;
}

.studio__example {
  color: var(--mute);
  font-size: 0.875rem;
}

.studio.is-live .studio__example {
  display: none;
}

.studio__status {
  display: grid;
  gap: 0.6rem;
}

.studio__alert {
  padding: 0.7rem 1rem;
  border-left: 2px solid var(--gold);
  background: var(--navy-deep);
  color: var(--on-navy);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.studio__alert--warn,
.studio__alert--error {
  border-left-color: var(--alert);
}

.studio__alert--error strong {
  color: var(--alert);
}

.studio__kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
}

@media (min-width: 40rem) {
  .studio__kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.studio__kpi {
  display: grid;
  align-content: start;
  gap: 0.2rem;
  min-width: 0;
  padding: 0.95rem 1rem 1.05rem 0;
  border-bottom: 1px solid var(--line);
}

.studio__kpi--lead {
  grid-column: 1 / -1;
  padding-block: 1.2rem 1.35rem;
}

.studio__kpi-label {
  color: var(--on-navy-mute);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.studio__kpi-value {
  color: var(--ivory);
  font-family: var(--serif);
  font-size: clamp(1.35rem, 1.1rem + 0.7vw, 1.7rem);
  font-weight: 400;
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.studio__kpi--lead .studio__kpi-value {
  color: var(--gold-hi);
  font-size: clamp(2.4rem, 1.6rem + 2.6vw, 3.6rem);
  font-weight: 300;
  letter-spacing: -0.01em;
}

.studio__kpi-sub {
  color: var(--mute);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.studio__words {
  display: grid;
  gap: 0.75rem;
  max-width: 40rem;
  color: var(--stone);
  font-size: 0.9875rem;
  line-height: 1.65;
}

.studio__charts {
  display: grid;
  gap: 2.5rem;
  min-width: 0;
}

/* ---------- Charts ---------- */

.studio-chart {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.studio-chart__head {
  display: grid;
  gap: 0.15rem;
}

.studio-chart__title {
  color: var(--ivory);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.studio-chart__sub,
.studio-chart__note {
  color: var(--mute);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.studio-chart__plot {
  position: relative;
  min-width: 0;
}

.studio-chart__plot:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: 4px;
}

.studio-chart__plot svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.studio-chart__tip {
  position: absolute;
  top: 0;
  z-index: 2;
  min-width: 9rem;
  max-width: 16rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line-strong);
  background: rgba(3, 12, 28, 0.96);
  color: var(--on-navy);
  font-size: 0.8125rem;
  line-height: 1.45;
  pointer-events: none;
}

.studio-chart__tip-title {
  margin-bottom: 0.2rem;
  color: var(--gold);
  font-weight: 600;
}

.studio-chart__tip span {
  color: var(--mute);
}

.studio-chart__tip strong {
  color: var(--ivory);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.studio-chart__data summary,
.studio__fold-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: fit-content;
  min-height: 2.5rem;
  color: var(--stone);
  font-size: 0.875rem;
  cursor: pointer;
  list-style: none;
}

.studio-chart__data summary::-webkit-details-marker,
.studio__fold-head::-webkit-details-marker {
  display: none;
}

.studio-chart__data summary::before,
.studio__fold-head::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid var(--gold);
  border-bottom: 1.5px solid var(--gold);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}

.studio-chart__data[open] summary::before,
.studio__fold[open] > .studio__fold-head::before {
  transform: rotate(45deg);
}

.sc-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  color: var(--stone);
  font-size: 0.8125rem;
}

.sc-key__item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.sc-key__item::before {
  content: "";
  width: 1.25rem;
  height: 0;
  border-top: 2.5px solid var(--gold);
}

.sc-key__item--1::before { border-top-color: var(--sky); }
.sc-key__item--2::before { border-top-color: var(--ivory); }
.sc-key__item--3::before { border-top-color: var(--alert); }
.sc-key__item--dash::before { border-top-style: dashed; }

.sc text {
  fill: var(--stone);
  font-family: var(--sans);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.sc .sc-axis-title,
.sc .sc-band-label {
  fill: var(--mute);
  font-size: 11px;
}

.sc .sc-value {
  fill: var(--ivory);
  font-size: 11.5px;
  font-weight: 600;
}

.sc .sc-ref-label,
.sc .sc-mark-label {
  fill: var(--on-navy);
  font-size: 11px;
  /* A halo in the page colour keeps a label readable where it crosses a bar or a line */
  paint-order: stroke;
  stroke: var(--black);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.sc .sc-heat-value {
  fill: var(--on-navy);
  font-size: 12px;
}

.sc .sc-heat-value--strong {
  fill: var(--black);
  font-weight: 600;
}

.sc-grid { stroke: var(--line); stroke-width: 1; }
.sc-grid--zero { stroke: var(--line-strong); }
.sc-xtick { stroke: var(--line-strong); }
.sc-line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; stroke: var(--gold); }
.sc-line--1 { stroke: var(--sky); }
.sc-line--2 { stroke: var(--ivory); }
.sc-line--3 { stroke: var(--alert); }
.sc-line--dash { stroke-dasharray: 7 5; }
.sc-area { fill: rgba(207, 154, 86, 0.13); stroke: none; }
.sc-area--1 { fill: rgba(142, 163, 207, 0.13); }
.sc-dot { fill: var(--black); stroke: var(--gold); stroke-width: 2; }
.sc-dot--1 { stroke: var(--sky); }
.sc-dot--2 { stroke: var(--ivory); }
.sc-dot--3 { stroke: var(--alert); }
.sc-bar { fill: var(--gold); }
.sc-bar--1 { fill: #5f77a6; }
.sc-bar--2 { fill: var(--stone); }
.sc-bar--3 { fill: var(--alert); }
.sc-bar--up { fill: var(--gold); }
.sc-bar--down { fill: var(--alert); }
.sc-bar--total { fill: #8ea3cf; }
.sc-connector { stroke: var(--mute); stroke-dasharray: 2 3; }
.sc-ref { stroke: var(--stone); stroke-width: 1.25; stroke-dasharray: 4 4; }
.sc-ref--alert { stroke: var(--alert); }
.sc-mark { stroke: var(--gold-hi); stroke-width: 1.25; stroke-dasharray: 2 4; }
.sc-point { fill: var(--gold-hi); stroke: var(--black); stroke-width: 2; }
.sc-band { fill: rgba(13, 36, 72, 0.55); }
.sc-hit { fill: transparent; pointer-events: all; }
.sc-guide { stroke: var(--ivory); stroke-width: 1; opacity: 0.45; pointer-events: none; }
.sc-heat { fill: var(--navy-deep); }
.sc-heat--p1 { fill: rgba(207, 154, 86, 0.18); }
.sc-heat--p2 { fill: rgba(207, 154, 86, 0.36); }
.sc-heat--p3 { fill: rgba(207, 154, 86, 0.66); }
.sc-heat--p4 { fill: rgba(235, 184, 102, 0.92); }
.sc-heat--n1 { fill: rgba(240, 144, 122, 0.18); }
.sc-heat--n2 { fill: rgba(240, 144, 122, 0.36); }
.sc-heat--n3 { fill: rgba(240, 144, 122, 0.66); }
.sc-heat--n4 { fill: rgba(240, 144, 122, 0.92); }
.sc-heat--base { stroke: var(--ivory); stroke-width: 2; }

/* ---------- Tables ---------- */

.studio__more {
  display: grid;
  gap: clamp(2.5rem, 5vw, 3.5rem);
  min-width: 0;
}

.studio__h2 {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 1.5rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.25;
}

.studio__h3 {
  color: var(--ivory);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.studio__tables {
  display: grid;
  gap: 1.5rem;
  min-width: 0;
}

.studio__table,
.studio__fold {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}

.studio__fold-head {
  width: 100%;
  color: var(--ivory);
  font-size: 1rem;
  font-weight: 600;
}

.studio__fold-sub,
.studio__table-sub,
.studio__table-note,
.studio__dl-note,
.studio__dl-intro,
.studio__scen-intro {
  color: var(--mute);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5;
}

.studio__fold-sub {
  margin-left: auto;
}

.studio__table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.studio__grid,
.sc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.studio__grid th,
.studio__grid td,
.sc-table th,
.sc-table td {
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.studio__grid thead th,
.sc-table thead th {
  color: var(--mute);
  font-size: 0.75rem;
  font-weight: 500;
  border-bottom-color: var(--line-strong);
}

.studio__grid tbody th,
.sc-table tbody th {
  color: var(--on-navy);
  font-weight: 400;
}

.studio__grid td,
.sc-table td {
  color: var(--ivory);
}

.studio__grid .num,
.sc-table .num {
  text-align: right;
  padding-left: 1rem;
}

.studio__grid tfoot th,
.studio__grid tfoot td {
  border-top: 1px solid var(--line-strong);
  border-bottom: 0;
  color: var(--ivory);
  font-weight: 600;
}

/* Subtotals and section labels inside a table: sources and uses, a bridge from one value to another */
.studio__grid tbody tr.is-total th,
.studio__grid tbody tr.is-total td {
  border-top: 1px solid var(--line-strong);
  color: var(--ivory);
  font-weight: 600;
}

.studio__grid tbody tr.is-head th {
  padding-top: 1rem;
  color: var(--gold);
  font-weight: 600;
}

.studio__kpi--alert .studio__kpi-value {
  color: var(--alert);
}

.studio__kpi--alert .studio__kpi-sub {
  color: var(--on-navy);
}

.studio__var {
  display: block;
  color: var(--mute);
  font-size: 0.75rem;
}

/* ---------- Scenarios and downloads ---------- */

.studio__scen,
.studio__downloads {
  display: grid;
  gap: 1rem;
  min-width: 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-strong);
}

.studio__scen-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.studio__scen-tab[aria-pressed="true"] {
  border-color: var(--gold-hi);
  background: var(--gold-hi);
  color: var(--black);
}

.studio__scen-add {
  border-style: dashed;
}

.studio__scen-note {
  color: var(--on-navy);
  font-size: 0.875rem;
  line-height: 1.55;
}

.studio__scen-actions,
.studio__dl-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.studio__rename {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.6rem;
}

.studio__rename .studio__label {
  flex-basis: 100%;
}

.studio__rename .studio__input {
  flex: 1 1 14rem;
}

.studio__grid--compare td {
  white-space: normal;
  min-width: 7rem;
}

/* ---------- The headline figure in reach on a phone ---------- */

.studio__peek {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem var(--gutter) calc(0.75rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--gold-line);
  background: rgba(0, 0, 0, 0.94);
  color: var(--ivory);
  text-decoration: none;
  transform: translateY(100%);
  transition: transform 0.3s var(--ease-out);
}

.studio__peek.is-on {
  transform: none;
}

@media (max-width: 61.99rem) {
  .studio__peek {
    display: flex;
  }
}

.studio__peek-label {
  min-width: 0;
  color: var(--on-navy-mute);
  font-size: 0.8125rem;
  line-height: 1.3;
}

.studio__peek-value {
  margin-left: auto;
  color: var(--gold-hi);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap;
}

.studio__peek-go {
  padding-left: 0.75rem;
  border-left: 1px solid var(--line-strong);
  color: var(--stone);
  font-size: 0.8125rem;
}

@media (prefers-reduced-motion: reduce) {
  .studio__peek {
    transition: none;
  }
}

/* ---------- The directory at /calculators ---------- */

.studio-search {
  display: grid;
  gap: 0.45rem;
  max-width: 34rem;
}

.studio-search .studio__input input {
  font-size: 1.125rem;
}

.studio-jump ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.studio-jump .chip {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.studio-dir {
  display: grid;
}

.studio-cat {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  padding-block: clamp(2rem, 5vw, 3.25rem);
  border-top: 1px solid var(--line);
}

@media (min-width: 54rem) {
  .studio-cat {
    grid-template-columns: var(--rail) minmax(0, 1fr);
    column-gap: clamp(1.5rem, 4vw, 4rem);
  }
}

.studio-cat__head {
  display: grid;
  align-content: start;
  gap: 0.5rem;
}

.studio-cat__name {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 1.3125rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.3;
}

.studio-cat__text {
  color: var(--mute);
  font-size: 0.875rem;
  line-height: 1.55;
}

/* Cards share hairlines: each has its own border, pulled over its neighbour's by a pixel, so a row
   with fewer cards than columns ends cleanly instead of leaving a filled gap */
.studio-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  padding: 0 1px 1px 0;
}

.studio-card {
  display: grid;
  margin: 0 -1px -1px 0;
  border: 1px solid var(--line);
  background: var(--black);
}

.studio-card__link {
  display: grid;
  align-content: start;
  gap: 0.55rem;
  padding: 1.35rem 1.4rem 1.5rem;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.25s ease;
}

.studio-card__name {
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1.2;
  text-wrap: balance;
}

.studio-card__text {
  color: var(--stone);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.studio-card__where {
  color: var(--gold);
  font-size: 0.8125rem;
}

@media (hover: hover) {
  .studio-card__link:hover {
    background: var(--navy-deep);
  }

  .studio-card__link:hover .studio-card__name {
    color: var(--gold-hi);
  }
}

.studio-card__link:focus-visible {
  outline: 2px solid var(--gold-hi);
  outline-offset: -2px;
}

.studio-recent {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
  padding: 1.1rem 0 0;
  border-top: 1px solid var(--line);
}

.studio-recent__name {
  color: var(--stone);
  font-size: 0.875rem;
  font-weight: 500;
}

.studio-recent__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.studio-recent__list a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.studio-dir__none {
  padding-block: 2rem;
  color: var(--stone);
}

.studio-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 1.5rem 2.5rem;
}

.studio-facts dt {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 1.15rem;
  font-style: italic;
  line-height: 1.3;
}

.studio-facts dd {
  margin-top: 0.4rem;
  color: var(--stone);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.studio-formula {
  display: block;
  margin-block: 0.5rem;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  border-left: 2px solid var(--gold-line);
  background: var(--navy-deep);
  color: var(--ivory);
  font: 500 0.9375rem/1.6 var(--sans);
  font-variant-numeric: tabular-nums;
  white-space: pre;
}

/* ---------- Print, or save as PDF ---------- */

.studio__print {
  display: none;
}

@media print {
  html,
  body {
    background: #fff !important;
    color: #111 !important;
  }

  .masthead,
  .foot,
  .thread,
  .skip,
  .studio__bar,
  .studio__in,
  .studio__scen,
  .studio__downloads,
  .studio__peek,
  .studio__example,
  .studio-chart__data,
  .studio__dl-note,
  .crumbs,
  .share {
    display: none !important;
  }

  .pagehead {
    padding-top: 0;
  }

  .pagehead__in {
    padding-block: 0 1rem;
  }

  .pagehead__title {
    color: #111;
    font-size: 26pt;
  }

  .pagehead__name,
  .studio__legend,
  .studio__h2 {
    color: #7a5420;
  }

  .studio__print {
    display: block;
  }

  .studio__print-meta {
    margin-bottom: 0.75rem;
    color: #555;
    font-size: 9pt;
  }

  .studio__work {
    display: block;
  }

  .studio__kpi-value,
  .studio__kpi--lead .studio__kpi-value,
  .studio__grid td,
  .studio__grid tfoot td,
  .studio__grid tfoot th,
  .studio-chart__title,
  .studio__h3,
  .studio__fold-head {
    color: #111 !important;
  }

  .studio__kpi-label,
  .studio__kpi-sub,
  .studio__words,
  .studio__grid tbody th,
  .studio__grid thead th,
  .studio-chart__sub,
  .studio-chart__note,
  .studio__table-note,
  .studio__alert,
  .sc-key {
    color: #444 !important;
  }

  .studio__alert {
    background: #f4f1ea;
  }

  .studio__kpis,
  .studio__kpi,
  .studio__grid th,
  .studio__grid td,
  .studio__table,
  .studio__fold {
    border-color: #ccc !important;
  }

  .studio-chart,
  .studio__table,
  .studio__fold,
  .studio__kpis {
    break-inside: avoid;
  }

  .sc text { fill: #333; }
  .sc .sc-value { fill: #111; }
  .sc-grid { stroke: #ddd; }
  .sc-grid--zero, .sc-xtick { stroke: #999; }
  .sc-line { stroke: #9a6a2a; }
  .sc-line--1 { stroke: #3f5a8c; }
  .sc-bar, .sc-bar--up { fill: #b7853f; }
  .sc-bar--1, .sc-bar--total { fill: #6f86b5; }
  .sc-bar--down, .sc-bar--3 { fill: #c4614a; }
  .sc-area { fill: rgba(154, 106, 42, 0.12); }
  .sc-dot { fill: #fff; }
  .sc-ref, .sc-mark { stroke: #666; }
  .sc .sc-heat-value { fill: #111; }
  .sc-heat { fill: #f2f2f2; }
  .sc-guide, .studio-chart__tip { display: none; }

  .band {
    break-inside: avoid-page;
  }
}

/* ---------- Page heads and the explanations below a tool ---------- */

.pagehead--studio .pagehead__in {
  gap: 1rem;
  padding-block: clamp(2rem, 5vw, 3.75rem) clamp(1.75rem, 4vw, 2.75rem);
}

.pagehead--studio .pagehead__title {
  max-width: 18em;
  font-size: clamp(2.2rem, 1.3rem + 3vw, 3.6rem);
}

.pagehead--studio .pagehead__lede {
  max-width: 44rem;
  margin-top: 0;
}

.pagehead--studio-home .pagehead__in {
  padding-block: clamp(2.75rem, 7vw, 5.5rem) clamp(2.25rem, 5vw, 3.75rem);
}

.pagehead--studio-home .pagehead__lede {
  max-width: 40rem;
}

.studio-home {
  position: relative;
  padding-bottom: clamp(2rem, 5vw, 3rem);
}

.studio-home .wrap {
  display: grid;
  gap: 1.75rem;
}

.studio-method {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
}

.studio-method__head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.75rem;
  color: var(--ivory);
  font-size: 1.0625rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.studio-method__head::-webkit-details-marker {
  display: none;
}

.studio-method__head::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 1.5px solid var(--gold);
  border-bottom: 1.5px solid var(--gold);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}

.studio-method[open] > .studio-method__head::before {
  transform: rotate(45deg);
}

.studio-method .prose {
  margin-top: 1rem;
}

.studio-links {
  display: grid;
  gap: 0.8rem;
  max-width: 44rem;
  color: var(--stone);
  font-size: 0.9875rem;
  line-height: 1.6;
}

@media print {
  .studio-method .prose {
    display: block;
  }

  .band {
    color: #111;
  }
}

.studio__grid--rules td {
  white-space: normal;
  min-width: 9rem;
  color: var(--on-navy);
}

.studio__grid--rules td:first-of-type {
  color: var(--ivory);
}

.sc-key__item--bar::before {
  width: 0.75rem;
  height: 0.75rem;
  border-top: 0;
  background: var(--gold);
}

.sc-key__item--bar.sc-key__item--1::before { background: #5f77a6; }
.sc-key__item--bar.sc-key__item--2::before { background: var(--stone); }
.sc-key__item--bar.sc-key__item--3::before { background: var(--alert); }

.sc-bar--range { opacity: 0.85; }
.sc-range-mid { stroke: var(--ivory); stroke-width: 2.5; }
.studio__scen-chart:empty { display: none; }
@media print {
  .sc-range-mid { stroke: #111; }
  .sc .sc-ref-label, .sc .sc-mark-label { stroke: #fff; }
}
