/* Adventures in Finance — site stylesheet
   Palette: ink (deep ledger green-black), paper (warm cream), red (ledger red).
   Type: Newsreader for reading, IBM Plex Mono for figures, dates and labels. */

:root {
  --ink: #17231f;
  --paper: #f4efe4;
  --red: #bf3a21;
  --muted: #56625c;
  --line: #d8d0bf;
  --card: #fbf8f1;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", "Courier New", monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.62;
  border-top: 5px solid var(--red);
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--red);
}

a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

.wrap {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Site header and footer */

.site-header {
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  padding-top: 1.1rem;
  padding-bottom: 1rem;
}

.site-name {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}

.site-footer {
  margin-top: 5rem;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.site-footer .wrap {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

/* Headings and opening */

main {
  padding-top: 3rem;
}

.kicker {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--red);
}

h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2.1rem, 7vw, 3.2rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

h2 {
  margin: 3.5rem 0 0.9rem;
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
}

p {
  margin: 0 0 1.15rem;
}

.standfirst {
  font-size: 1.32rem;
  line-height: 1.45;
  margin-bottom: 2rem;
}

.paper-meta {
  margin: 0 0 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted);
}

.paper-meta a {
  color: var(--muted);
}

/* Lists */

ul,
ol {
  margin: 0 0 1.4rem;
  padding-left: 1.3rem;
}

li {
  margin-bottom: 0.55rem;
}

li::marker {
  color: var(--red);
}

/* Ledger: label on the left, figure on the right */

.ledger {
  margin: 1.75rem 0 0.5rem;
  border-top: 2px solid var(--ink);
}

.ledger div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px dotted var(--muted);
}

.ledger dt {
  flex: 1 1 14rem;
  font-size: 1.02rem;
  line-height: 1.35;
}

.ledger dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 500;
  white-space: nowrap;
}

.ledger .loss {
  color: var(--red);
}

.ledger-note {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
}

/* Figure and chart */

.figure {
  margin: 2.5rem 0;
  padding: 1.5rem 1.1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--line);
}

.figure-title {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

/* A chart drawn on a narrow, phone-sized canvas: stop it growing too large on wide screens */

.chart--narrow {
  max-width: 27rem;
}

.chart-axis {
  stroke: var(--ink);
  stroke-width: 2;
}

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

.chart-bar--base {
  fill: var(--ink);
}

/* An amount that is estimated but not observed: outline only */

.chart-bar--open {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-dasharray: 6 5;
}

/* The spread between studies: a paler continuation of a bar */

.chart-bar--range {
  fill: var(--ink);
  opacity: 0.28;
}

/* A ceiling the data rule out: a thin red tick */

.chart-limit {
  stroke: var(--red);
  stroke-width: 2;
}

.chart-label {
  font-family: var(--mono);
  font-size: 16px;
  fill: var(--ink);
}

.chart-group {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  fill: var(--muted);
}

.chart-scale {
  font-family: var(--mono);
  font-size: 13px;
  fill: var(--muted);
}

.chart-value {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  fill: var(--ink);
}

figcaption {
  margin-top: 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--muted);
}

/* Note: for warnings about the evidence */

.note {
  margin: 1.75rem 0;
  padding: 1.25rem 1.25rem 0.4rem;
  background: var(--card);
  border-left: 4px solid var(--red);
}

.note p:first-child {
  margin-top: 0;
}

blockquote {
  margin: 1.75rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--ink);
  font-size: 1.25rem;
  font-style: italic;
  line-height: 1.45;
}

/* Sources and research line */

.sources {
  font-size: 0.98rem;
  line-height: 1.5;
}

.sources a {
  overflow-wrap: anywhere;
}

.researched {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted);
}

/* Index page */

.intro {
  font-size: 1.32rem;
  line-height: 1.45;
  margin-bottom: 0.9rem;
}

.agent-line {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0;
}

.paper-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 2px solid var(--ink);
}

.paper-item {
  margin: 0;
  padding: 1.6rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
}

.paper-date {
  display: block;
  margin-bottom: 0.45rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
}

.paper-title {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
}

.paper-summary {
  margin: 0;
  color: var(--muted);
}

/* Wider screens */

@media (min-width: 40rem) {
  body {
    font-size: 1.2rem;
  }

  main {
    padding-top: 4.5rem;
  }

  .figure {
    padding: 2rem 2rem 1.5rem;
  }

  .note {
    padding: 1.5rem 1.75rem 0.6rem;
  }
}