/* AvidQuant landing page.
   The colour values are the desks' own tokens (tokens.css in the hosted
   services), so the three sites stay one family. --bar and --mark-ground
   are this page's own additions. Dark is the default;
   light follows the system setting. No script, nothing from a third party. */

@font-face {
  font-family: "Archivo";
  src: url("assets/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;

  --ground: #000000;
  --surface: #15171b;
  --surface-sunken: #0a0b0d;
  --line: #23262c;
  --line-strong: #343943;
  --text: #e8eaed;
  --text-muted: #939aa6;
  --accent: #6ea0ff;
  --signal: #e2e800;
  --signal-ink: #000000;
  --loss: #ff6b6b;
  --synthetic: #c4b5fd;
  --synthetic-ground: #1a142e;
  --degraded: #fdba74;
  --degraded-ground: #2a1206;
  --bar: #636b79;
  --mark-ground: #0c1a33;

  --sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --page: 82rem;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --ground: #ffffff;
    --surface: #f6f6f7;
    --surface-sunken: #ececee;
    --line: #d4d4d8;
    --line-strong: #a1a1aa;
    --text: #1d1d1f;
    --text-muted: #5a5a60;
    --accent: #1d4ed8;
    --signal: #5c5f00;
    --signal-ink: #ffffff;
    --loss: #b91c1c;
    --synthetic: #5b21b6;
    --synthetic-ground: #f3efff;
    --degraded: #9a3412;
    --degraded-ground: #fdf0e7;
    --bar: #7c8493;
    --mark-ground: #e8eefc;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  scrollbar-color: var(--line-strong) var(--ground);
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums lining-nums;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent);
  color: var(--ground);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
  border-radius: 2px;
}

h1,
h2,
h3,
p,
dl,
dd,
ol,
ul,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

code,
.digest {
  font-family: var(--mono);
  font-size: 0.875em;
}

.wrap {
  width: min(100% - 2 * var(--gutter), var(--page));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  padding: 0.6rem 0.9rem;
  background: var(--signal);
  color: var(--signal-ink);
  font-weight: 600;
  text-decoration: none;
  z-index: 10;
}

.skip:focus {
  top: 0.75rem;
}

/* ---- Header ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-stretch: 112%;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

.brand svg {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
}

.site-nav ul {
  display: flex;
  gap: clamp(0.9rem, 2.4vw, 2rem);
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  padding-block: 0.5rem;
}

.site-nav a:hover {
  color: var(--text);
}

/* ---- Opening ---- */

.opening {
  padding-block: clamp(1.25rem, 2vw, 1.75rem) clamp(3rem, 6vw, 5rem);
}

.opening-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1.5rem clamp(2rem, 5vw, 4rem);
}

.opening h1 {
  max-width: 40ch;
  font-size: clamp(1.5rem, 1.05rem + 1.3vw, 2.125rem);
  line-height: 1.1;
  font-weight: 600;
  font-stretch: 108%;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.opening .lede {
  max-width: 84ch;
  margin-top: 0.6rem;
  color: var(--text-muted);
  font-size: 1rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.15rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9875rem;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.button svg {
  width: 1rem;
  height: 1rem;
  flex: none;
  transition: transform 0.25s var(--ease);
}

.button:hover {
  border-color: var(--text);
}

.button:hover svg {
  transform: translate(2px, -2px);
}

.button:active {
  transform: translateY(1px);
}

.button--primary {
  background: var(--text);
  border-color: var(--text);
  color: var(--ground);
}

.button--primary:hover {
  background: var(--ground);
  border-color: var(--text);
  color: var(--text);
}

/* ---- Specimen: the figure and its record ---- */

.specimen {
  margin-top: clamp(1.25rem, 2.2vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-sunken) 100%);
  overflow: hidden;
}

.specimen-top {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 7fr);
  align-items: center;
  gap: clamp(1.5rem, 3vw, 3rem);
  padding: clamp(1rem, 1.6vw, 1.25rem) clamp(1.5rem, 3.4vw, 2.75rem) clamp(0.75rem, 1.4vw, 1rem);
}

.reading-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
}

.flag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--synthetic-ground);
  color: var(--synthetic);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.flag.part {
  border-radius: 999px;
}

.flag::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
}

.reading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.3em;
  margin-top: 0.6rem;
  font-weight: 640;
  font-stretch: 118%;
  font-size: clamp(3rem, 1rem + 5.4vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  color: var(--text);
}

.reading .unit {
  font-size: 0.34em;
  font-weight: 560;
  font-stretch: 100%;
  letter-spacing: 0;
  color: var(--text-muted);
}

.reading-second {
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 1rem;
}

.reading-second strong {
  color: var(--text);
  font-weight: 600;
}

.part {
  border-radius: 4px;
  box-shadow: 0 0 0 0 transparent;
  transition: background-color 0.25s var(--ease), box-shadow 0.25s var(--ease),
    color 0.25s var(--ease);
}

/* Chart */

.chart {
  min-width: 0;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart .bar {
  fill: var(--bar);
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

.chart .bar--tail {
  fill: var(--loss);
}

.chart .axis {
  stroke: var(--line-strong);
  stroke-width: 1;
}

.chart .tick {
  fill: var(--text-muted);
  font-family: var(--sans);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.chart .marker line {
  stroke: var(--text);
  stroke-width: 1.5;
  transition: stroke-width 0.25s var(--ease), stroke 0.25s var(--ease);
}

.chart .marker--es line {
  stroke-dasharray: 5 4;
}

.chart .marker text {
  fill: var(--text);
  font-family: var(--sans);
  font-size: 16.5px;
  font-weight: 600;
}

.chart .side {
  fill: var(--text-muted);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 500;
  transition: fill 0.25s var(--ease);
}

.chart figcaption {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  max-width: 60ch;
}

@media (prefers-reduced-motion: no-preference) {
  .chart .bar {
    animation: rise 0.9s var(--ease) both;
    animation-delay: calc(var(--i) * 9ms + 120ms);
  }

  @keyframes rise {
    from {
      transform: scaleY(0.3);
      opacity: 0.35;
    }
    to {
      transform: scaleY(1);
      opacity: 1;
    }
  }
}

/* Record */

.record {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(1.5rem, 4vw, 3.5rem);
  padding: 0 clamp(1.5rem, 3.4vw, 2.75rem) clamp(1.25rem, 2.6vw, 2rem);
}

.row {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.65rem 0.5rem;
  margin-inline: -0.5rem;
  border-top: 1px solid var(--line);
  border-radius: 4px;
  transition: background-color 0.2s var(--ease);
}

.row dt {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.row dd {
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.row--wide {
  grid-column: 1 / -1;
}

.row .ok {
  font-weight: 600;
}

.assumptions li + li {
  margin-top: 0.3rem;
}

.specimen-foot {
  padding: 1rem clamp(1.5rem, 3.4vw, 2.75rem);
  border-top: 1px solid var(--line);
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Pointing at a row of the record marks what it governs in the reading. */

@media (hover: hover) {
  .row:hover {
    background: var(--mark-ground);
  }

  .specimen:has(.row--confidence:hover) .part--confidence,
  .specimen:has(.row--horizon:hover) .part--horizon,
  .specimen:has(.row--currency:hover) .part--currency,
  .specimen:has(.row--mode:hover) .part--mode,
  .specimen:has(.row--es:hover) .part--es {
    background: var(--mark-ground);
    box-shadow: 0 0 0 0.3em var(--mark-ground);
    color: var(--text);
  }

  .specimen:has(.row--sign:hover) .chart .side--loss,
  .specimen:has(.row--observations:hover) .chart .side--count {
    fill: var(--accent);
  }

  .specimen:has(.row--es:hover) .chart .marker--es line,
  .specimen:has(.row--method:hover) .chart .marker--var line {
    stroke: var(--accent);
    stroke-width: 3;
  }
}

/* ---- Sections ---- */

.section {
  padding-block: clamp(3.5rem, 7vw, 6rem);
  border-top: 1px solid var(--line);
}

.section > .wrap > h2 {
  max-width: 26ch;
  font-size: clamp(1.375rem, 1rem + 1.2vw, 2rem);
  line-height: 1.12;
  font-weight: 600;
  font-stretch: 108%;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.section-intro {
  max-width: 62ch;
  margin-top: 0.9rem;
  color: var(--text-muted);
}


/* ---- Meter bridge: Risk Desk's limit check ----
   The one warm material on the page: ivory meter faces behind glass,
   black needles, red only past the limit. */

.bridge-flags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  max-width: 76ch;
  margin-top: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.flag--degraded {
  background: var(--degraded-ground);
  color: var(--degraded);
}

.bridge {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.75rem, 1.6vw, 1.25rem);
  margin-top: clamp(1.75rem, 3.5vw, 2.5rem);
  padding: clamp(0.75rem, 1.6vw, 1.25rem);
  border-radius: 14px;
  background: linear-gradient(180deg, #2a1e15 0%, #1a130d 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 18px 40px -24px rgba(0, 0, 0, 0.8);
}

.meter {
  padding: clamp(0.75rem, 1.4vw, 1.1rem) clamp(0.75rem, 1.4vw, 1.1rem) 1rem;
  border-radius: 8px;
  background: radial-gradient(120% 90% at 50% 0%, #f6efdc 0%, #e9dfc3 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 10px 18px -12px rgba(0, 0, 0, 0.45);
  color: #17140f;
}

.meter svg {
  display: block;
  width: 100%;
  height: auto;
}

.meter .scale,
.meter .t {
  fill: none;
  stroke: #17140f;
  stroke-width: 2;
}

.meter .t--major {
  stroke-width: 3;
}

.meter .over {
  fill: none;
  stroke: #c8102e;
  stroke-width: 9;
}

.meter .warn {
  stroke: #17140f;
  stroke-width: 6;
}

.meter .n {
  fill: #17140f;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  font-stretch: 112%;
}

.meter .needle line {
  stroke: #17140f;
  stroke-width: 3.5;
  stroke-linecap: round;
}

.meter--breach .needle line {
  stroke: #c8102e;
}

.meter .needle {
  transform-box: view-box;
  transform-origin: 150px 150px;
  transform: rotate(var(--a));
}

.meter .pivot {
  fill: #17140f;
}

.m-name {
  margin-top: 0.4rem;
  font-weight: 600;
  font-size: 0.9375rem;
}

.m-value {
  margin-top: 0.15rem;
  font-size: clamp(1.375rem, 1.1rem + 0.8vw, 1.75rem);
  font-weight: 640;
  font-stretch: 116%;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.m-value span {
  font-size: 0.55em;
  font-weight: 500;
  font-stretch: 100%;
  letter-spacing: 0;
  color: #4a4336;
}

.m-status {
  margin-top: 0.35rem;
  font-size: 0.875rem;
  color: #4a4336;
}

.meter--warning .m-status {
  color: #17140f;
  font-weight: 600;
}

.meter--breach .m-status {
  color: #a10d25;
  font-weight: 700;
}

.bridge-foot {
  max-width: 76ch;
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

@media (prefers-reduced-motion: no-preference) {
  .meter .needle {
    animation: swing 1.4s var(--ease) both;
    animation-delay: calc(var(--n, 0) * 90ms + 200ms);
  }

  @keyframes swing {
    from {
      transform: rotate(-60deg);
    }
    to {
      transform: rotate(var(--a));
    }
  }
}

/* Desks */

.desks {
  margin-top: clamp(2rem, 4vw, 3rem);
}

.desk {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 5fr) minmax(0, 3fr);
  gap: clamp(1.25rem, 3vw, 3rem);
  padding-block: clamp(1.75rem, 3.5vw, 2.5rem);
  border-top: 1px solid var(--line-strong);
}

.desk:last-child {
  border-bottom: 1px solid var(--line-strong);
}

.desk h3 {
  font-size: clamp(1.25rem, 1.05rem + 0.7vw, 1.625rem);
  line-height: 1.1;
  font-weight: 640;
  font-stretch: 114%;
  letter-spacing: -0.02em;
}

.desk-summary {
  margin-top: 0.75rem;
  color: var(--text-muted);
  max-width: 38ch;
}

.facts .fact {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 0.75rem;
  padding-block: 0.6rem;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
}

.facts .fact:first-child {
  border-top: 0;
  padding-top: 0;
}

.facts dt {
  color: var(--text-muted);
}

.facts dd {
  overflow-wrap: anywhere;
}

.desk-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.desk-links .plain {
  font-size: 0.9375rem;
}

/* Work */

.work {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(2rem, 5vw, 5rem);
  margin-top: clamp(2rem, 4vw, 3rem);
}

.area {
  padding-block: 1.6rem;
  border-top: 1px solid var(--line);
}

.area h3 {
  font-size: 1.1875rem;
  line-height: 1.2;
  font-weight: 620;
  font-stretch: 108%;
  letter-spacing: -0.012em;
}

.area p {
  margin-top: 0.6rem;
  color: var(--text-muted);
  max-width: 52ch;
}

.area .shown {
  margin-top: 0.75rem;
  color: var(--text);
  font-size: 0.9375rem;
}

/* Questions */

.questions {
  margin-top: clamp(2rem, 4vw, 3rem);
  max-width: 54rem;
}

.question {
  padding-block: 1.4rem;
  border-top: 1px solid var(--line);
}

.question dt {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
}

.question dd {
  margin-top: 0.55rem;
  color: var(--text-muted);
  max-width: 68ch;
}

/* Contact */

.contact {
  background: var(--surface);
}

.contact h2 {
  max-width: none;
}

.contact-address {
  display: inline-block;
  margin-top: 1.5rem;
  color: var(--text);
  font-size: clamp(1.75rem, 0.9rem + 3.9vw, 4.25rem);
  font-weight: 620;
  font-stretch: 112%;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-decoration-thickness: 0.07em;
  text-underline-offset: 0.16em;
  overflow-wrap: anywhere;
  transition: text-decoration-thickness 0.25s var(--ease), color 0.25s var(--ease);
}

.contact-address:hover {
  text-decoration-thickness: 0.14em;
}

.contact-note {
  max-width: 58ch;
  margin-top: 1.5rem;
  color: var(--text-muted);
}

/* Footer: the same on all three AvidQuant sites */

.site-footer {
  padding-block: 2.5rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.site-footer .wrap {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 1.5rem 4rem;
}

.footer-note p {
  max-width: 72ch;
}

.footer-note p + p {
  margin-top: 0.75rem;
}

.footer-note strong {
  color: var(--text);
  font-weight: 600;
}

.footer-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 2rem;
  align-content: start;
}

.footer-nav li + li {
  margin-top: 0.4rem;
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--text);
}

/* ---- Narrow screens ---- */

@media (max-width: 60rem) {
  .opening-head {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .specimen-top {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .desk {
    grid-template-columns: minmax(0, 1fr);
  }

  .bridge {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .desk-links {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .site-footer .wrap {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 44rem) {
  body {
    font-size: 1rem;
  }

  .site-nav li:nth-child(n + 3):not(:last-child) {
    display: none;
  }

  .record,
  .work {
    grid-template-columns: minmax(0, 1fr);
  }

  .bridge {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meter .n {
    font-size: 30px;
  }

  .meter .t {
    stroke-width: 3;
  }

  .row {
    grid-template-columns: 7.5rem minmax(0, 1fr);
  }


  .chart .tick {
    font-size: 32px;
    transform: translateY(16px);
  }

  .chart .side {
    display: none;
  }

  .chart .marker text {
    font-size: 30px;
  }

  .chart svg {
    margin-bottom: 0.75rem;
  }

  .actions {
    flex-wrap: nowrap;
  }

  .actions .open {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .actions .button {
    flex: 1 1 0;
    justify-content: center;
    padding-inline: 0.6rem;
    font-size: 0.9375rem;
  }

  .row--wide,
  .facts .fact {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.25rem;
  }

  .desk-links {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-header,
  .skip {
    display: none;
  }

  :root {
    --ground: #ffffff;
    --surface: #ffffff;
    --surface-sunken: #ffffff;
    --line: #bbbbbb;
    --line-strong: #888888;
    --text: #000000;
    --text-muted: #333333;
    --accent: #1d4ed8;
    --loss: #b91c1c;
    --synthetic: #5b21b6;
    --synthetic-ground: #f3efff;
    --bar: #666666;
    --mark-ground: #ffffff;
  }

  body {
    background: #fff;
    color: #000;
  }
}
