/* Page-specific styling for the GDP forecasting project.
 * Shared chrome comes from ../project-base.css.
 *
 * Two colours run through the page: ink for what actually happened, coral for
 * what a model said would happen. A third, darker red is reserved for the two
 * pandemic quarters, which the page spends a section on.
 */

.gd-shell {
  --gd-actual: #1f3a4d;
  --gd-model: #c2643a;
  --gd-shock: #9a3b2c;
  --gd-good: #2f6d55;
  --gd-mono: "Cascadia Mono", "JetBrains Mono", ui-monospace, "DejaVu Sans Mono",
    "Segoe UI Mono", Menlo, Consolas, monospace;
}

/* --------------------------------------------------------------- rhythm */

.project-section {
  padding-block: clamp(2.5rem, 5vw, 4.5rem);
}

.gd-shell .section-rail span:first-child {
  color: var(--gd-model);
}

/* ---------------------------------------------------------- typography */

.project-section-body h2 {
  margin: 0;
  max-width: 24ch;
  font-size: clamp(1.65rem, 3.6vw, 2.5rem);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.project-question h2 {
  max-width: 26ch;
}

.project-section-body h3 {
  margin: clamp(2.25rem, 4.5vw, 3.25rem) 0 0.85rem;
  font-size: clamp(1.05rem, 2.1vw, 1.28rem);
  font-weight: 500;
  letter-spacing: -0.015em;
}

.project-section-body > p {
  max-width: 62ch;
  margin: 1.15rem 0 0;
  font-size: 0.97rem;
  line-height: 1.72;
}

.project-section-body .lede {
  max-width: 58ch;
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.68;
}

.project-section-body .project-section-intro {
  max-width: 62ch;
  color: var(--muted);
}

.gd-shell .project-section .project-eyebrow {
  color: var(--gd-model);
}

/* ------------------------------------------------------ table of contents */

.project-toc {
  width: min(100%, calc(var(--content-width) + (2 * var(--gutter))));
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1.35rem;
  margin-inline: auto;
  padding: 1.1rem var(--gutter);
  border-bottom: 1px solid var(--line);
}

.project-toc-label {
  margin-right: 0.4rem;
  color: var(--faint);
  font-size: 0.59rem;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.project-toc a {
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 130ms ease, border-color 130ms ease;
}

.project-toc a:hover {
  color: var(--gd-model);
  border-bottom-color: var(--gd-model);
}

/* ---------------------------------------------------------------- hero */

.hero-figure {
  margin: 0.7rem 0;
}

.hero-figure canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(246, 244, 237, 0.14);
}

.hero-analysis-footer i {
  display: inline-block;
  width: 0.85rem;
  height: 2px;
  margin-right: 0.4rem;
  vertical-align: 0.22em;
}

.key-actual {
  background: #e8ece9;
}

.key-model {
  background: #e5a37e;
}

/* ------------------------------------------------------------- equations */

.eq {
  margin: 1.2rem 0 0;
  padding: 0.95rem 1.1rem;
  border-left: 2px solid var(--gd-actual);
  background: var(--paper-deep);
  overflow-x: auto;
}

.eq img {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
}

.eq-inline {
  margin-top: 0.9rem;
  padding: 0.65rem 0.8rem;
}

.eq-inline img {
  zoom: 0.8;
}

.project-section-body > .eq-note,
.eq-note {
  max-width: 62ch;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}

/* --------------------------------------------------------------- callout */

.callout {
  max-width: 62ch;
  margin-top: clamp(2rem, 4vw, 2.75rem);
  padding: clamp(1.15rem, 2.6vw, 1.6rem);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gd-actual);
  background: #fbfaf6;
}

.callout-flag {
  border-left-color: var(--gd-shock);
}

.callout p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.72;
}

.callout strong {
  color: var(--ink);
}

/* --------------------------------------------------------- shared controls */

.control-hint {
  margin: 0.55rem 0 0;
  max-width: 36ch;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.field-readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.field-readout > div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: clamp(0.85rem, 2vw, 1.15rem);
  background: var(--paper);
}

.field-readout span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.field-readout strong {
  font-size: clamp(1.15rem, 2.3vw, 1.45rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.field-readout small {
  color: var(--faint);
  font-size: 0.7rem;
}

/* ------------------------------------------------------------ diagnostics */

.diag-panel {
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  background: var(--paper);
}

.diag-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem 2rem;
  padding: clamp(1rem, 2.4vw, 1.4rem);
  border-bottom: 1px solid var(--line);
}

.diag-note {
  flex: 1 1 22rem;
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.diag-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1px;
  background: var(--line);
}

.diag-block {
  padding: clamp(1.1rem, 2.6vw, 1.6rem);
  background: var(--paper);
}

.diag-block h4 {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  font-weight: 600;
}

.diag-block h4 small {
  display: block;
  margin-top: 0.25rem;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 500;
}

.diag-list {
  list-style: none;
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
}

.diag-list li {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr) 4.6rem;
  align-items: center;
  gap: 0.7rem;
}

.diag-name {
  color: var(--ink);
  font-size: 0.78rem;
}

.diag-track {
  height: 6px;
  background: var(--paper-deep);
}

.diag-track i {
  display: block;
  height: 100%;
  transition: width 200ms ease;
}

.diag-pass .diag-track i {
  background: var(--gd-good);
}

.diag-fail .diag-track i {
  background: var(--gd-shock);
}

.diag-value {
  color: var(--muted);
  font-family: var(--gd-mono);
  font-size: 0.72rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.diag-caption {
  margin: 1.1rem 0 0;
  color: var(--faint);
  font-size: 0.75rem;
  line-height: 1.55;
}

/* --------------------------------------------------------------- models */

.model-list {
  counter-reset: model;
  list-style: none;
  display: grid;
  /* four models, so two columns rather than auto-fit, which lands on three
   * at this width and leaves a row-and-a-half of empty grid showing */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: clamp(1.75rem, 3.5vw, 2.5rem) 0 0;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--line);
}

.model-list > li {
  counter-increment: model;
  display: flex;
  flex-direction: column;
  padding: clamp(1.2rem, 2.8vw, 1.7rem);
  background: var(--paper);
}

.model-list > li::before {
  content: counter(model, decimal-leading-zero);
  display: block;
  color: var(--gd-model);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.model-list h3 {
  margin: 0.55rem 0 0.3rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.model-kind {
  margin: 0 0 0.7rem !important;
  color: var(--faint) !important;
  font-size: 0.7rem !important;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.model-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.68;
}

.model-list .eq {
  margin-top: auto;
  padding-top: 0.9rem;
}

/* -------------------------------------------------------------- explorer */

.explorer-panel,
.error-panel {
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  background: var(--paper);
}

.explorer-controls,
.error-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: clamp(1rem, 2.5vw, 2rem);
  padding: clamp(1.1rem, 2.5vw, 1.6rem);
  border-bottom: 1px solid var(--line);
}

.explorer-figure,
.error-figure {
  margin: 0;
  padding: clamp(0.85rem, 2vw, 1.3rem);
}

.explorer-figure canvas,
.error-figure canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  cursor: crosshair;
  touch-action: none;
}

.explorer-figure figcaption,
.error-figure figcaption {
  margin-top: 0.75rem;
  max-width: 68ch;
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.55;
}

.error-controls {
  align-items: center;
}

.error-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 550;
  cursor: pointer;
}

.error-toggle input {
  accent-color: var(--gd-shock);
  width: 1rem;
  height: 1rem;
}

/* ------------------------------------------------------------- baselines */

.results-table-wrap .table-oracle th,
.results-table-wrap .table-oracle td {
  color: var(--faint);
}

.results-table-wrap .cell-no {
  color: var(--gd-shock);
  font-weight: 600;
}

/* -------------------------------------------------------------- spreads */

.spread-grid {
  display: grid;
  gap: 1px;
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  border: 1px solid var(--line);
  background: var(--line);
}

.spread-row {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr) 9.5rem;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem clamp(1rem, 2.4vw, 1.4rem);
  background: var(--paper);
}

.spread-name {
  color: var(--ink);
  font-size: 0.82rem;
}

.spread-bar {
  position: relative;
  height: 10px;
  background: var(--paper-deep);
}

.spread-bar i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--lo);
  right: calc(100% - var(--hi));
  background: var(--gd-model);
}

.spread-row-actual .spread-bar i {
  background: var(--gd-actual);
}

.spread-value {
  color: var(--muted);
  font-family: var(--gd-mono);
  font-size: 0.73rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ next steps */

.next-list {
  counter-reset: next;
  list-style: none;
  display: grid;
  gap: 1px;
  margin: clamp(1.75rem, 3.5vw, 2.5rem) 0 0;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--line);
}

.next-list > li {
  counter-increment: next;
  padding: clamp(1.2rem, 2.8vw, 1.7rem);
  background: var(--paper);
}

.next-list > li::before {
  content: counter(next, decimal-leading-zero);
  display: block;
  margin-bottom: 0.55rem;
  color: var(--gd-model);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.next-list h3 {
  margin: 0 0 0.55rem;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.next-list p {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

/* ---------------------------------------------------------- findings grid */

.finding-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: clamp(2.25rem, 4.5vw, 3.25rem);
  border: 1px solid var(--line);
  background: var(--line);
}

.finding-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(1.3rem, 3vw, 1.9rem);
  border-top: 3px solid transparent;
  background: #fbfaf6;
}

.finding-card-good {
  border-top-color: var(--gd-good);
}

.finding-card-flag {
  border-top-color: var(--gd-shock);
}

.finding-card h3 {
  margin: 0 0 0.7rem;
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.finding-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.7;
}

.project-aside {
  margin-top: clamp(2rem, 4vw, 2.75rem);
  padding: clamp(1.2rem, 2.8vw, 1.75rem);
  border-left: 2px solid var(--gd-model);
  background: var(--paper-deep);
}

.project-aside .project-eyebrow {
  margin: 0;
}

.project-aside p + p {
  max-width: 62ch;
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.89rem;
  line-height: 1.7;
}

/* ------------------------------------------------------------ references */

.refs {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.refs h3 {
  margin: 1.75rem 0 0.7rem;
  color: var(--faint);
  font-size: 0.59rem;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.refs h3:first-child {
  margin-top: 0;
}

.refs p {
  max-width: 66ch;
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.65;
}

.refs a {
  color: var(--gd-model);
}

.refs-note {
  color: var(--faint);
}

/* -------------------------------------------------------- call to action */

.project-cta {
  padding-block: clamp(3.25rem, 6vw, 5.5rem);
}

.project-cta h2 {
  margin-inline: 0 auto;
  max-width: 30ch;
  font-size: clamp(1.65rem, 3.6vw, 2.5rem);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -0.025em;
}

.project-cta-links {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 980px) {
  .finding-grid,
  .project-cta-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .model-list,
  .finding-grid,
  .project-cta-links,
  .explorer-controls,
  .error-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .diag-list li {
    grid-template-columns: 6rem minmax(0, 1fr) 4rem;
    gap: 0.5rem;
  }

  .spread-row {
    grid-template-columns: 7rem minmax(0, 1fr);
    row-gap: 0.4rem;
  }

  .spread-value {
    grid-column: 2;
    text-align: left;
  }

  .eq img {
    zoom: 0.85;
  }
}

@media print {
  .project-toc,
  .diag-panel,
  .explorer-panel,
  .error-panel {
    display: none;
  }
}
