/* ============================================================
   Implic Capital — Research article stylesheet
   Deep-sea navy, gold accents, Cormorant Garamond display.
   Matches implic-website.vercel.app brand tokens.
   ============================================================ */

:root {
  --deep-sea: #022045;
  --deep-sea-deep: #00183e;
  --tide-grey: #8198b3;
  --gold: #bf9f7e;
  --ink: #dbe4ef;          /* body text on deep sea */
  --ink-strong: #f3f6fa;   /* emphasis / headings */
  --ink-muted: #8198b3;    /* captions, meta */
  --hairline: rgba(129, 152, 179, 0.28);
  --hairline-soft: rgba(129, 152, 179, 0.16);
  --panel: rgba(129, 152, 179, 0.07);

  /* Chart series — validated for CVD + contrast on deep-sea surface */
  --series-1: #c08432;  /* gold */
  --series-2: #5595dc;  /* azure */
  --series-3: #2aa88a;  /* aqua */
  --series-4: #d4664a;  /* coral */
  --series-5: #9784db;  /* violet */
  --chart-grid: rgba(129, 152, 179, 0.18);
  --chart-axis: rgba(129, 152, 179, 0.55);

  --font-display: "Cormorant Garamond", serif;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
}

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

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

body {
  background: var(--deep-sea);
  background-image: linear-gradient(180deg, var(--deep-sea-deep) 0%, var(--deep-sea) 320px);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 1.0625rem;
  line-height: 1.85;
  letter-spacing: 0.01em;
}

::selection { background: rgba(191, 159, 126, 0.35); }

/* ---------- masthead ---------- */
.masthead {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.masthead .wordmark {
  font-family: var(--font-display);
  color: var(--ink-strong);
  font-size: 1.35rem;
  letter-spacing: 0.30em;
  text-transform: uppercase;
  text-decoration: none;
  font-weight: 500;
}
.masthead .wordmark span { color: var(--gold); font-size: 0.62rem; letter-spacing: 0.48em; display: block; margin-top: 0.1rem; font-family: var(--font-sans); font-weight: 300; }
.masthead .series-tag {
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.masthead a.series-tag:hover { opacity: 1; }

/* ---------- hero ---------- */
.hero {
  max-width: 46rem;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3rem;
}
.hero .kicker {
  font-size: 0.72rem;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.6rem;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink-strong);
  font-size: clamp(2.1rem, 5.5vw, 3.4rem);
  line-height: 1.18;
  margin-bottom: 1.6rem;
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum" 1;
}
.hero .subtitle {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--tide-grey);
  line-height: 1.5;
  margin-bottom: 1.8rem;
}
.hero .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding-top: 1.4rem;
  border-top: 1px solid var(--hairline);
}
.hero .meta b { color: var(--ink); font-weight: 500; }

/* ---------- abstract / notes panel ---------- */
.notes {
  max-width: 46rem;
  margin: 0 auto 1rem;
  padding: 0 1.5rem;
}
.notes-inner {
  border: 1px solid var(--hairline);
  border-left: 2px solid var(--gold);
  background: var(--panel);
  padding: 1.9rem 2.1rem;
}
.notes-inner .notes-label {
  font-size: 0.7rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.1rem;
}
.notes-inner p { margin-bottom: 1em; font-size: 0.98rem; line-height: 1.8; }
.notes-inner p:last-child { margin-bottom: 0; }

/* ---------- article body ---------- */
article {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

article p { margin-bottom: 1.35em; }
article strong { color: var(--ink-strong); font-weight: 500; }
article em { color: var(--ink); }
article a { color: var(--gold); text-decoration: none; border-bottom: 1px solid rgba(191,159,126,.4); }
article a:hover { border-bottom-color: var(--gold); }

.section {
  margin-top: 4.2rem;
}
.section-no {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 1rem;
  letter-spacing: 0.3em;
  margin-bottom: 0.5rem;
}
article h2 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink-strong);
  font-size: 1.9rem;
  line-height: 1.28;
  margin-bottom: 0.6rem;
}
.section > .rule {
  width: 3.2rem;
  height: 1px;
  background: var(--gold);
  border: 0;
  margin: 1.1rem 0 1.9rem;
}
article h3 {
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--ink-strong);
  font-size: 1.12rem;
  letter-spacing: 0.02em;
  margin: 2.4rem 0 1rem;
}
article ul, article ol { margin: 0 0 1.35em 1.3em; }
article li { margin-bottom: 0.5em; }
article li::marker { color: var(--gold); }

/* pull quote */
.pull {
  border-left: 2px solid var(--gold);
  padding: 0.4rem 0 0.4rem 1.6rem;
  margin: 2.2rem 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.55;
  color: var(--ink-strong);
}
.pull .attr { display: block; margin-top: 0.7rem; font-family: var(--font-sans); font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-muted); }

/* ---------- figures ---------- */
figure {
  margin: 2.6rem auto;
}
figure.wide { width: min(58rem, calc(100vw - 3rem)); margin-left: 50%; transform: translateX(-50%); }
figure img {
  max-width: 100%;
  display: block;
  margin: 0 auto;
  border: 1px solid var(--hairline-soft);
}
figure.photo img { background: #fff; }
figure svg { display: block; width: 100%; height: auto; }
figcaption {
  margin-top: 0.9rem;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}
figcaption .fig-no { color: var(--gold); letter-spacing: 0.18em; text-transform: uppercase; margin-right: 0.6rem; }

.figure-panel {
  border: 1px solid var(--hairline-soft);
  background: var(--panel);
  padding: 1.6rem 1.6rem 1.2rem;
}
.figure-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-strong);
  margin-bottom: 0.2rem;
}
.figure-sub {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-bottom: 1.1rem;
}

/* chart legend */
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin: 0.6rem 0 0.9rem; font-size: 0.78rem; color: var(--ink); }
.legend .key { display: inline-flex; align-items: center; gap: 0.45rem; }
.legend .swatch { width: 0.85rem; height: 0.24rem; border-radius: 2px; display: inline-block; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; margin: 2.4rem 0; }
figure .table-scroll, .figure-panel .table-scroll { margin: 0; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
  line-height: 1.55;
}
thead th {
  font-weight: 500;
  color: var(--gold);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--gold);
  white-space: nowrap;
}
tbody td, tbody th {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--hairline-soft);
  vertical-align: top;
  text-align: left;
  font-weight: 300;
}
tbody th { color: var(--ink-strong); font-weight: 500; }
tbody tr:hover { background: rgba(129,152,179,0.06); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.hl { color: var(--gold); font-weight: 500; }

/* stat band */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.6rem;
  margin: 2.4rem 0;
}
.stats .stat { background: var(--panel); border: 1px solid var(--hairline-soft); padding: 1.3rem 1.2rem; }
.stats .stat .v { font-family: var(--font-display); font-size: 1.9rem; color: var(--ink-strong); line-height: 1.15; }
.stats .stat .v em { font-style: normal; color: var(--gold); }
.stats .stat .k { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); margin-top: 0.35rem; line-height: 1.5; }

/* ---------- references / footer ---------- */
.refs { margin-top: 4rem; padding-top: 1.8rem; border-top: 1px solid var(--hairline); }
.refs h2 { font-size: 1.3rem; }
.refs ol { margin-top: 1.2rem; font-size: 0.85rem; color: var(--ink-muted); }
.refs a { color: var(--tide-grey); border-bottom-color: var(--hairline); overflow-wrap: anywhere; }

.disclaimer {
  margin-top: 2.6rem;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--ink-muted);
  border-top: 1px solid var(--hairline-soft);
  padding-top: 1.6rem;
}

footer.site {
  border-top: 1px solid var(--hairline);
  margin-top: 2rem;
  padding: 3.5rem 1.5rem 3rem;
  position: relative;
  overflow: hidden;
}
footer.site .inner { max-width: 46rem; margin: 0 auto; position: relative; }
footer.site .tagline { font-family: var(--font-display); font-size: 1.5rem; color: var(--ink-strong); margin-bottom: 0.9rem; }
footer.site .about { font-size: 0.92rem; color: var(--tide-grey); max-width: 34rem; margin-bottom: 1.4rem; }
footer.site .contact { font-size: 0.85rem; color: var(--ink-muted); }
footer.site .contact a { color: var(--gold); text-decoration: none; }
footer.site .legal { font-size: 0.75rem; color: rgba(129,152,179,.6); margin-top: 2.2rem; }
footer.site svg.waves { position: absolute; bottom: -1rem; left: 0; width: 100%; height: 120px; opacity: 0.5; pointer-events: none; }

@media (max-width: 640px) {
  .notes-inner { padding: 1.4rem 1.2rem; }
  figure.wide { width: calc(100vw - 2rem); }
}
