/* Teal Insights Debt Swap Explorer — brand palette from brand.typ
   (locked, June 2026). Typography: this is an open-source public repo, so
   only open-licensed fonts are used (Source Serif 4 and Inter, both OFL,
   loaded from Google Fonts). No licensed house typefaces are shipped or
   referenced. */

:root {
  --ink: #143E5A;
  --teal: #0094BC;
  --terracotta: #B5380C;
  --gold: #C9971F;
  --sage: #83A39A;
  --slate: #5C6770;
  --surface: #FAFAF7;
  --divider: #D4D0CA;
  --body-ink: #2A2A2A;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--serif);
  color: var(--body-ink);
  background: var(--surface);
  line-height: 1.55;
}

/* ---------- header ---------- */
header {
  background: var(--ink);
  color: #fff;
  padding: 1.4rem 2rem 1.2rem;
}
.masthead { max-width: 1200px; margin: 0 auto; display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.wordmark { display: inline-block; text-decoration: none; }
.wordmark img { height: 46px; width: auto; display: block; }
header h1 { font-size: 1.7rem; font-weight: 600; margin-top: .35rem; }
header .subtitle { font-family: var(--sans); font-size: .92rem; color: #cfe0ea; margin-top: .3rem; max-width: 62ch; }
header nav a {
  font-family: var(--sans); font-size: .85rem; color: #fff;
  text-decoration: none; border: 1px solid rgba(255,255,255,.4);
  padding: .35rem .8rem; border-radius: 4px;
}
header nav a:hover { background: rgba(255,255,255,.12); }

main { max-width: 1200px; margin: 0 auto; padding: 1.5rem 2rem 4rem; }

/* ---------- research-preview notice ---------- */
.preview-notice {
  font-family: var(--sans); font-size: .85rem; line-height: 1.55;
  color: var(--body-ink); background: #FCF6E8;
  border: 1px solid var(--divider); border-left: 4px solid var(--gold);
  border-radius: 6px; padding: .75rem 1rem; margin: 1.2rem 0 0;
  max-width: 100ch;
}
.preview-notice strong { color: var(--ink); }
.preview-notice a { color: var(--teal); }

/* ---------- persona tabs ---------- */
.personas { display: flex; gap: .5rem; margin: 1rem 0 1.2rem; flex-wrap: wrap; }
.persona-btn {
  font-family: var(--sans); font-size: .9rem; cursor: pointer;
  padding: .5rem 1.1rem; border: 1px solid var(--divider);
  background: #fff; color: var(--slate); border-radius: 20px;
}
.persona-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.persona-note {
  font-size: .95rem; color: var(--slate); max-width: 78ch;
  margin-bottom: 1.4rem; font-style: italic;
}

/* ---------- layout ---------- */
.grid { display: grid; grid-template-columns: 400px 1fr; gap: 1.6rem; }
@media (max-width: 960px) { .grid { grid-template-columns: 1fr; } }

.panel {
  background: #fff; border: 1px solid var(--divider);
  border-radius: 8px; padding: 1.1rem 1.2rem; margin-bottom: 1.4rem;
}
.panel h2 {
  font-family: var(--sans); font-size: .78rem; letter-spacing: .09em;
  text-transform: uppercase; color: var(--slate); margin-bottom: .8rem;
}

/* ---------- inputs ---------- */
label { font-family: var(--sans); font-size: .74rem; color: var(--slate); display: block; margin-bottom: .15rem; }
input, select {
  font-family: var(--sans); font-size: .85rem; color: var(--body-ink);
  border: 1px solid var(--divider); border-radius: 4px;
  padding: .32rem .45rem; width: 100%; background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--teal); outline-offset: -1px; }
input:disabled, select:disabled { background: #F1EFEA; color: var(--slate); }
.row { display: grid; gap: .55rem; margin-bottom: .6rem; }
.row.c2 { grid-template-columns: 1fr 1fr; }
.row.c3 { grid-template-columns: 1fr 1fr 1fr; }
/* Inputs align to the bottom of their cell so two-line labels don't
   stagger the boxes; labels grow to fill the space above. */
.row > div { display: flex; flex-direction: column; justify-content: flex-end; }
.row > div > label { flex: 1 0 auto; }
.instrument {
  border: 1px solid var(--divider); border-left: 3px solid var(--sage);
  border-radius: 6px; padding: .55rem .8rem .3rem; margin-bottom: .7rem;
}
.inst-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: .35rem;
}
.inst-head .tag {
  font-family: var(--sans); font-size: .68rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--sage); font-weight: 600;
}
.instrument .del {
  cursor: pointer; border: none; background: none; color: var(--terracotta);
  font-family: var(--sans); font-size: .78rem; padding: 0;
}
.del-yield {
  cursor: pointer; border: none; background: none; color: var(--terracotta);
  font-family: var(--sans); font-size: .85rem; padding: .32rem .3rem; width: auto;
}
.btn {
  font-family: var(--sans); font-size: .85rem; cursor: pointer;
  border: 1px solid var(--ink); background: #fff; color: var(--ink);
  padding: .4rem .9rem; border-radius: 4px;
}
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }
.btn:hover { filter: brightness(.96); }
.hint { font-size: .78rem; font-family: var(--sans); color: var(--slate); margin: .3rem 0 .6rem; }

/* ---------- metric cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: .8rem; margin-bottom: 1.4rem; }
.card {
  background: #fff; border: 1px solid var(--divider); border-radius: 8px;
  padding: .8rem .9rem;
}
.card.hero { border-top: 3px solid var(--teal); }
.card .k { font-family: var(--sans); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--slate); min-height: 2.2em; }
.card .v { font-family: var(--sans); font-size: 1.45rem; font-weight: 650; color: var(--ink); margin-top: .15rem; }
.card .v.neg { color: var(--terracotta); }
.card .s { font-size: .74rem; font-family: var(--sans); color: var(--slate); margin-top: .1rem; }

/* ---------- charts ---------- */
.chart-title { font-family: var(--sans); font-weight: 600; font-size: .95rem; color: var(--ink); margin-bottom: .1rem; }
.chart-sub { font-family: var(--sans); font-size: .78rem; color: var(--slate); margin-bottom: .5rem; }
.axis text { font-family: var(--sans); font-size: 11px; fill: var(--slate); }
.axis path, .axis line { stroke: var(--divider); }
.legend { font-family: var(--sans); font-size: 11.5px; fill: var(--slate); }

/* ---------- WB-comparable savings table ---------- */
.savings-table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: .88rem; margin-top: .4rem; }
.savings-table th { text-align: left; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--slate); padding: .3rem .5rem .3rem 0; border-bottom: 1px solid var(--divider); }
.savings-table td { padding: .38rem .5rem .38rem 0; border-bottom: 1px solid var(--divider); vertical-align: baseline; }
.savings-table td:first-child { white-space: nowrap; padding-right: 1.2rem; }
.savings-table td.num, .savings-table th.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); white-space: nowrap; }
.savings-table td.num.neg { color: var(--terracotta); }
.savings-table td.note { color: var(--slate); font-size: .76rem; padding-left: 1rem; width: 45%; }
@media (max-width: 720px) { .savings-table td:first-child { white-space: normal; } .savings-table td.note { display: none; } }

/* ---------- chart tooltips ---------- */
.d3tip {
  position: fixed; pointer-events: none; z-index: 50;
  background: var(--ink); color: #fff; font-family: var(--sans);
  font-size: .78rem; line-height: 1.45; padding: .45rem .6rem;
  border-radius: 5px; box-shadow: 0 2px 8px rgba(20,62,90,.25);
  opacity: 0; transition: opacity .08s;
}
.d3tip .tt-year { font-weight: 700; margin-bottom: .1rem; display: block; }
.d3tip .sw { display: inline-block; width: .6em; height: .6em; border-radius: 2px; margin-right: .35em; }

footer {
  border-top: 1px solid var(--divider); font-family: var(--sans);
  color: var(--slate); font-size: .8rem; padding: 1.2rem 2rem 2.5rem;
  max-width: 1200px; margin: 0 auto;
}
footer a { color: var(--teal); }

/* ---------- methodology page ---------- */
article { max-width: 76ch; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
article a { color: var(--teal); }
article a:visited { color: var(--teal); }
article h1 { color: var(--ink); font-size: 1.9rem; margin-bottom: .4rem; }
article h2 { color: var(--ink); font-size: 1.25rem; margin: 2rem 0 .6rem; }
article h3 { color: var(--ink); font-family: var(--sans); font-size: .95rem; margin: 1.3rem 0 .4rem; }
article p, article li { margin-bottom: .7rem; font-size: 1.02rem; }
article ul, article ol { padding-left: 1.4rem; margin-bottom: .8rem; }
article code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: #eef1f0; font-size: .85em; padding: .08em .3em; border-radius: 3px;
}
article table { border-collapse: collapse; width: 100%; margin: .8rem 0 1.2rem; font-family: var(--sans); font-size: .88rem; }
article th { text-align: left; font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; color: var(--slate); }
article th, article td { border-bottom: 1px solid var(--divider); padding: .45rem .5rem .45rem 0; vertical-align: top; }
article blockquote { border-left: 3px solid var(--sage); padding: .2rem 0 .2rem 1rem; color: var(--slate); margin: .8rem 0; }
.byline { font-family: var(--sans); color: var(--slate); font-size: .85rem; margin-bottom: 1.6rem; }
