/*
  RunwayTreasury design system.
  Positioning: neutral, independent AUTHORITY. Reads like a trusted editorial
  research desk, not another gradient-heavy SaaS landing page. Restraint is the
  brand. Calm, high-trust, practitioner. No hype.

  Fonts (loaded in BaseLayout.astro head via preconnect + display=swap):
    - Source Serif 4  -> headings, wordmark, editorial voice
    - Inter           -> UI, body copy, tables, data
*/

:root {
  /* Ink / text */
  --ink: #16191d;          /* near-black, warm. Primary text. */
  --ink-soft: #545b63;     /* muted secondary text, captions, bylines */
  --ink-faint: #7a828b;    /* quietest trust signals (dates, meta) */

  /* Brand / accent. Deep, muted editorial slate-blue. Not SaaS-bright. */
  --accent: #1f3d54;       /* primary brand color, links, wordmark mark */
  --accent-strong: #16303f;/* hover / pressed */
  --accent-soft: #eef2f5;  /* faint tint for table headers, callouts */
  --accent-line: #cdd8df;  /* accent-tinted borders (e.g. featured cells) */

  /* Backgrounds. Warm paper, not stark white. Signals "publication". */
  --bg: #fbfaf7;           /* page background, warm off-white */
  --surface: #ffffff;      /* cards, tables, raised surfaces */
  --surface-alt: #f5f4f0;  /* zebra rows, quiet fills */

  /* Lines */
  --line: #e4e1da;         /* default hairline border, warm neutral */
  --line-strong: #d3cfc6;  /* stronger dividers */

  /* A single, sparing signal color for the affiliate/disclosure amber. */
  --amber: #8a6d3b;
  --amber-soft: #f7f2e7;
  --amber-line: #e6d9bd;

  /* Type */
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;

  /* Measure. Comfortable reading column ~68ch. */
  --measure: 42rem;        /* ~68ch at this size, prose column */
  --measure-wide: 52rem;   /* tables / hubs can breathe wider */

  --radius: 6px;
  --radius-lg: 10px;
}

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

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 1.375rem;
}

/* ---------------------------------------------------------------------------
   Header + wordmark
   The wordmark is text-only: "Runway" (soft) + "Treasury" (accent), set in the
   serif so it reads editorial from the first glance. A thin rule under the
   header keeps it feeling like a masthead.
--------------------------------------------------------------------------- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-top: 1.15rem;
  padding-bottom: 1.15rem;
}
.site-header .brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.015em;
  white-space: nowrap;
}
/* Weight/tone split inside the single link so it still reads as one word. */
.site-header .brand .mark-runway {
  color: var(--ink);
  font-weight: 500;
}
.site-header .brand .mark-treasury {
  color: var(--accent);
  font-weight: 600;
}
.site-header .brand:hover .mark-treasury {
  color: var(--accent-strong);
}

.site-header nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-header nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.site-header nav a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent-line);
}

/* ---------------------------------------------------------------------------
   Main content column + prose
--------------------------------------------------------------------------- */
main.content {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem 1.375rem 4rem;
}

/* Wider content (comparison hub, homepage grid) can opt into more room. */
main.content:has(.cluster-grid),
main.content:has(table) {
  max-width: var(--measure-wide);
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.015em;
}
h1 {
  font-size: 2.35rem;
  line-height: 1.15;
  margin: 0 0 1rem;
}
h2 {
  font-size: 1.55rem;
  line-height: 1.25;
  margin: 2.75rem 0 0.85rem;
  padding-top: 0.25rem;
}
h3 {
  font-size: 1.2rem;
  line-height: 1.3;
  margin: 2rem 0 0.6rem;
}

/* Constrain prose blocks to a comfortable measure even in a wide container. */
main.content > article p,
main.content > article ul,
main.content > article ol,
.hero p,
main.content > p {
  max-width: var(--measure);
}

p,
ul,
ol {
  margin: 0 0 1.15rem;
}
li {
  margin-bottom: 0.35rem;
}

a {
  color: var(--accent);
  text-decoration-color: var(--accent-line);
  text-underline-offset: 2px;
}
a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

strong {
  font-weight: 600;
  color: var(--ink);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

/* ---------------------------------------------------------------------------
   Comparison tables. The core asset. Must be scannable and premium.
   Wrapped visually via border-radius + overflow on the table itself; scrolls
   horizontally on small screens without breaking layout.
--------------------------------------------------------------------------- */
main.content article {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.75rem 0 2rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.5;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
th,
td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
th:last-child,
td:last-child {
  border-right: 0;
}
tbody tr:last-child td {
  border-bottom: 0;
}
/* Header row: quiet accent tint, small caps feel via tracking + weight. */
thead th {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--accent-line);
}
/* First column = row label. Treated as a quiet header for scannability. */
tbody th,
tbody td:first-child {
  background: var(--surface-alt);
  font-weight: 600;
  color: var(--ink);
  font-family: var(--sans);
}
tbody tr:hover td {
  background: #fcfbf9;
}
tbody tr:hover td:first-child {
  background: #efeee9;
}

/* ---------------------------------------------------------------------------
   Blockquotes / BLUF callouts.
   Markdown blockquotes carry two jobs on content pages:
     1. "Bottom line up front" style pull quotes.
     2. The affiliate CTA lines ("> Open a Mercury account: [AFFILIATE: Mercury]").
   Base blockquote = calm editorial callout. Affiliate rows are styled below
   via the [AFFILIATE: ...] marker, which we surface (not hide) as a labeled,
   tasteful CTA slot rather than a spammy button.
--------------------------------------------------------------------------- */
blockquote {
  margin: 1.75rem 0;
  padding: 1rem 1.35rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.02rem;
}
blockquote p {
  margin: 0;
}
blockquote p + p {
  margin-top: 0.75rem;
}

/* ---------------------------------------------------------------------------
   Affiliate CTA slots.
   The content ships literal "[AFFILIATE: Mercury]" tokens inside markdown
   blockquotes, e.g. "> Open a Mercury account: [AFFILIATE: Mercury]".
   We do NOT alter that copy. The comparison template ([slug].astro) tags any
   blockquote whose text contains an affiliate token with class="affiliate"
   after render, so we can surface it as an honest, clearly-labeled placement
   (a quiet amber slot with an "Affiliate link" tag) instead of a spammy
   button. Un-tagged blockquotes stay editorial. This is the trust-building
   move on a YMYL site: name the incentive, do not hide it.
--------------------------------------------------------------------------- */
blockquote.affiliate {
  border: 1px solid var(--amber-line);
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  position: relative;
  padding-top: 1.6rem;
}
blockquote.affiliate::before {
  content: "Affiliate link";
  position: absolute;
  top: 0.55rem;
  left: 1.35rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
}
blockquote.affiliate p {
  font-weight: 500;
}

/* ---------------------------------------------------------------------------
   Trust signals: "Last reviewed", disclosure lines, draft banner.
   Quiet on purpose. Credibility reads as understatement.
--------------------------------------------------------------------------- */
.reviewed {
  color: var(--ink-faint);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.reviewed a {
  color: var(--ink-soft);
}

.draft-banner {
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  color: #6f5522;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 1.75rem;
}

/* ---------------------------------------------------------------------------
   Homepage hero + cluster hub
--------------------------------------------------------------------------- */
.hero {
  margin-bottom: 2.75rem;
}
.hero h1 {
  font-size: 2.6rem;
  max-width: 20ch;
}
.hero p.lede {
  font-size: 1.18rem;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: var(--measure);
}

.cluster-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
  margin: 2rem 0 2.5rem;
}
@media (min-width: 40rem) {
  .cluster-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.cluster-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.6rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.cluster-card:hover {
  border-color: var(--accent-line);
  box-shadow: 0 1px 0 var(--line-strong), 0 6px 24px -18px rgba(31, 61, 84, 0.4);
}
.cluster-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.3rem;
}
.cluster-card p {
  margin-bottom: 0.75rem;
  color: var(--ink-soft);
}
.cluster-card p:last-child {
  margin-bottom: 0;
}
.cluster-card a {
  font-weight: 500;
}

/* ---------------------------------------------------------------------------
   Author bio / E-E-A-T trust block. Should look credible, like a masthead
   contributor note, not a marketing box.
--------------------------------------------------------------------------- */
.author-bio {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  background: var(--surface);
  margin: 2.75rem 0;
}
.author-bio h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  letter-spacing: 0;
  text-transform: uppercase;
  font-family: var(--sans);
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
}
.author-bio p {
  margin-bottom: 0.9rem;
}
.author-bio p:last-child {
  margin-bottom: 0;
}
.byline {
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.6;
  font-style: italic;
}
.author-guarantee {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* ---------------------------------------------------------------------------
   Footer. Quiet masthead colophon.
--------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  padding: 2rem 0 3rem;
  background: var(--bg);
}
.site-footer .wrap {
  max-width: var(--measure);
}
.site-footer .disclosure {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.site-footer .meta {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-bottom: 0;
  letter-spacing: 0.01em;
}
.site-footer a {
  color: var(--ink-soft);
}
.site-footer a:hover {
  color: var(--accent);
}

/* ---------------------------------------------------------------------------
   Small screens
--------------------------------------------------------------------------- */
@media (max-width: 34rem) {
  html {
    font-size: 17px;
  }
  h1,
  .hero h1 {
    font-size: 1.95rem;
  }
  main.content {
    padding: 2.25rem 1.125rem 3rem;
  }
  .site-header .wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }
  table {
    font-size: 0.85rem;
  }
  th,
  td {
    padding: 0.55rem 0.65rem;
  }
}
