/* Measures: /measures and /measures/<id>. Loaded on those pages only, after site.css, and uses its tokens.
   No inline style anywhere: the script sets state with classes, attributes and the CSSOM.
   Formulas are set in a math serif with italic variables. STIX Two Text is not self-hosted (no download was allowed
   when this was built), so the fallback stack applies. If the font files are added later, add @font-face lines here. */

[hidden] { display: none !important; }

.eq { font-family: "STIX Two Text", "Cambria Math", "Times New Roman", serif; white-space: nowrap; }
.eq i { font-style: italic; }
.fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-size: .9em; margin: 0 .1em; }
.fr > span:first-child { border-bottom: 1.3px solid currentColor; padding: 0 .25em .05em; }
.fr > span:last-child { padding: .05em .25em 0; }
.ov { border-top: 1.3px solid currentColor; padding: 0 .1em; }

.mz { --mz-gap: 14px; }
.mz--calc { padding-top: var(--s4); }
.mz h1 { max-width: none; font-size: clamp(32px, 5vw, 52px); margin-bottom: var(--s1); }
.mz h2 { font-size: clamp(20px, 2.4vw, 26px); margin-bottom: var(--s1); }

/* catalog tools */
.mz-search { display: flex; align-items: center; gap: 10px; max-width: 720px; padding: 0 16px; background: var(--field-bg); border: 1.5px solid var(--field-line); border-radius: 14px; color: var(--fg2); }
.mz-search:focus-within { border-color: var(--ds-gold); box-shadow: 0 0 0 2px var(--ds-gold); }
.mz-search input[type="search"] { flex: 1; min-width: 0; height: 58px; border: 0; background: none; box-shadow: none; padding: 0; border-radius: 0; font-size: 18px; color: var(--fg); outline: none; }
.mz-search kbd { font: 13px var(--ds-font-body); border: 1px solid var(--field-line); border-radius: 6px; padding: 1px 7px; color: var(--fg2); }
.mz-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 18px; }
.mz-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mz-chip { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--field-line); background: var(--field-bg); color: var(--fg); font: 500 15px var(--ds-font-body); cursor: pointer; }
.mz-chip span { margin-left: 6px; font-size: 13px; color: var(--fg2); }
.mz-chip:hover { border-color: var(--ds-gold); }
.mz-chip[aria-pressed="true"] { background: var(--ds-parchment); border-color: var(--ds-parchment); color: var(--ds-ink); }
.mz-chip[aria-pressed="true"] span { color: var(--ds-slate); }
.mz-sort { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--fg2); }
.mz-sort select, .mz-field select { min-height: 44px; padding: 0 10px; font: 400 16px var(--ds-font-body); color: var(--fg); background: var(--field-bg); border: 1.5px solid var(--field-line); border-radius: 10px; }
.mz-count { margin: 24px 0 12px; font-size: 14px; color: var(--fg2); }
.mz-empty { padding: 34px 0; color: var(--fg2); }

/* card grid */
.mz-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: var(--mz-gap); }
.mz-item { display: flex; }
.mz-card { display: flex; flex-direction: column; width: 100%; padding: 16px; text-decoration: none; color: var(--fg); background: var(--ds-ink-2); border: 1.5px solid var(--line); border-radius: 16px; transition: transform .18s, border-color .18s; }
.mz-card:hover { border-color: var(--ds-gold); transform: translateY(-2px); }
.mz-card__eq { display: flex; align-items: center; min-height: 88px; margin-bottom: 14px; padding: 10px 12px; overflow-x: auto; font-size: 19px; color: var(--ds-ink); background: var(--ds-sand); border-radius: 10px; }
/* one inner box, centred with auto margins: a formula wider than the card scrolls from its start instead of being clipped, and its spaces survive */
.mz-card__eq > span { margin: auto; }
.mz-card__name { font: 600 17px/1.3 var(--ds-font-head); }
.mz-card__desc { flex: 1; margin-top: 4px; font-size: 14px; color: var(--fg2); }
.mz-card__meta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 13px; color: var(--fg2); }
.mz-badge { padding: 2px 9px; border-radius: 999px; background: var(--ds-gold); color: var(--ds-ink); font-weight: 600; }

/* calculator page */
.mz-back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: var(--s1); color: var(--ds-gold); font-weight: 600; text-decoration: none; }
.mz-back:hover { text-decoration: underline; }
.mz-sub { color: var(--fg2); max-width: 70ch; }
.mz-hero { margin: 18px 0 0; padding: 8px 0; overflow-x: auto; font-size: clamp(22px, 3.4vw, 34px); }
.mz-calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 18px; margin-top: 22px; }
.mz-panel { padding: 20px; border: 1.5px solid var(--line); border-radius: 16px; background: var(--ds-ink-2); }

/* the form is a Parchment sheet, like the other forms on the site */
.mz-form { --bg: var(--ds-parchment); --fg: var(--ds-ink); --fg2: var(--ds-slate); --line: color-mix(in srgb, var(--ds-ink) 14%, transparent); --field-bg: var(--ds-parchment); --field-line: color-mix(in srgb, var(--ds-ink) 38%, transparent); --focus: var(--ds-blue); color-scheme: light; background: var(--bg); color: var(--fg); border-color: transparent; }
.mz-form :focus-visible { outline: 2px solid var(--ds-blue); outline-offset: 2px; }
.mz-field { display: grid; gap: 5px; margin-bottom: 14px; }
.mz-field label { font-size: 14px; font-weight: 600; }
.mz-field select { width: 100%; }
.mz-inp { display: flex; align-items: center; background: var(--field-bg); border: 1.5px solid var(--field-line); border-radius: 10px; overflow: hidden; }
.mz-inp:focus-within { border-color: var(--ds-blue); }
.mz-inp input { flex: 1; min-width: 0; height: 46px; padding: 0 12px; border: 0; background: none; font: 400 16px var(--ds-font-body); color: var(--fg); text-align: right; font-variant-numeric: tabular-nums; outline: none; }
.mz-unit { padding: 0 12px; font-size: 14px; color: var(--fg2); white-space: nowrap; }
.mz-inp .mz-unit:first-child { padding-right: 0; }
.mz-field textarea { width: 100%; min-height: 84px; padding: 10px 12px; font: 400 16px var(--ds-font-body); color: var(--fg); background: var(--field-bg); border: 1.5px solid var(--field-line); border-radius: 10px; resize: vertical; }
.mz-reset { color: var(--ds-ink); border-color: var(--field-line); }

/* the result panel */
.mz-result { display: flex; flex-direction: column; }
.mz-lab, .mz-rlab { margin: 0; font-size: 14px; color: var(--fg2); }
.mz-big { margin: 4px 0 16px; font: 600 clamp(34px, 5.6vw, 60px)/1.08 var(--ds-font-head); letter-spacing: -.02em; color: var(--ds-gold); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mz-rows { margin-bottom: 16px; }
.mz-rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; overflow-wrap: anywhere; }
.mz-rows b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.mz-subr { margin: 0 0 14px; font-size: 13px; color: var(--fg2); overflow-wrap: anywhere; }
.mz-warn { margin: 0; padding-left: 10px; border-left: 3px solid var(--ds-gold); color: var(--fg); font-size: 15px; }
.mz-nojs { margin: 0; color: var(--fg2); }
.mz-copy { margin-top: auto; align-self: flex-start; }

/* compound interest chart */
.mz-chart { margin-top: 18px; }
.mz-legend { display: flex; flex-wrap: wrap; gap: 18px; margin: 6px 0 0; font-size: 14px; color: var(--fg2); }
.mz-sw { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.mz-sw--a { background: var(--ds-stone); }
.mz-sw--b { background: var(--ds-gold); }
.mz-fig { position: relative; min-height: 300px; margin-top: 10px; }
.mz-fig > svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.mz-about { max-width: 68ch; margin-top: 26px; }
.mz-about p { color: var(--fg2); }
.mz-related { margin-top: 32px; }
.mz-related .mz-grid { margin-top: 12px; }
.mz-note { margin: 34px 0 0; font-size: 13px; color: var(--fg2); }

.mz-card:focus-visible, .mz-chip:focus-visible, .mz-back:focus-visible, .mz-sort select:focus-visible { outline: 3px solid var(--ds-gold); outline-offset: 3px; }

@media (max-width: 760px) {
  .mz-calc { grid-template-columns: minmax(0, 1fr); }
  .mz-sort { margin-left: 0; }
  .mz-panel { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .mz-card { transition: none; }
  .mz-card:hover { transform: none; }
}
