/*
 * Nexus changelog — "verifiable ledger" theme.
 *
 * Concept: a changelog is an append-only record of changes, which is exactly what a
 * verifiable exchange is built on. The page reads as a ledger — a hairline chain rail
 * with monospace block-timestamps and a single blue "verified" node per entry. Palette
 * and type are brand-mandated (brand/tokens); the ledger rail is the signature element,
 * and the blue accent lives only on the node + links.
 */
:root {
  --black: #000000;
  --surface: #0a0a0b;
  --hairline: #1b1b1e;
  --hairline-strong: #2a2a30;
  --white: #ffffff;
  --text: #e0e0e0;
  --muted: rgba(255, 255, 255, 0.45);
  --faint: rgba(255, 255, 255, 0.22);
  --accent: #0095ff; /* Nexus Blue — node + links only, never fills */
  --accent-soft: rgba(0, 149, 255, 0.1); /* pill / tag fill — blue tints, never solid-fills */
  --accent-edge: rgba(0, 149, 255, 0.3); /* pill / tag border */
  --card: #0c0c0e; /* entry-card fill, a hair above the canvas */

  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, monospace;

  --rail: 80px; /* gutter width that holds the ledger rail */
  --maxw: 760px;
  --pill: 999px; /* full pill, matches nexus.xyz .pill */
  --card-radius: 12px;
}

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

html {
  font-variation-settings: 'opsz' 14;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--black);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.65;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---- Masthead ------------------------------------------------------------ */
.masthead {
  padding: 5rem 0 3.5rem;
  border-bottom: 1px solid var(--hairline);
}

.brandline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 3rem;
}
.brandline .wordmark {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.28em;
  font-size: 0.82rem;
  color: var(--white);
}
.brandline .sep {
  width: 1px;
  height: 0.9rem;
  background: var(--hairline-strong);
}
.brandline .kicker {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: var(--muted);
}

.thesis {
  font-weight: 200;
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--white);
  margin: 0;
  max-width: 18ch;
}
.thesis em {
  font-style: normal;
  color: var(--accent);
}

.standfirst {
  margin: 1.5rem 0 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 1.02rem;
}

.stat-line {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  margin-top: 2rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}
.stat-line .stat strong {
  color: var(--accent);
  font-weight: 500;
}

/* ---- Ledger / timeline --------------------------------------------------- */
.ledger {
  padding: 1rem 0 6rem;
}

.entry {
  position: relative;
  padding: 3rem 1.25rem 3rem var(--rail);
  border-radius: var(--card-radius);
  transition: background 0.15s ease;
}
/* Hover lifts the row into a card without breaking the continuous chain rail. */
.entry:hover {
  background: var(--card);
}
.entry::before {
  /* the chain rail */
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--hairline);
}
.entry:first-child::before {
  top: 3.2rem;
}
.entry:last-child::before {
  bottom: auto;
  height: 3.2rem;
}
.entry::after {
  /* the verified node */
  content: '';
  position: absolute;
  left: 0;
  top: 3rem;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--black);
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 4px var(--black), 0 0 12px rgba(0, 149, 255, 0.35);
}

/* ---- Pills / tags (component language borrowed from nexus.xyz + the landing) -- */
.meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.pill,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  border-radius: var(--pill);
  white-space: nowrap;
}
/* Date pill — the block-timestamp, now a pill */
.pill--date {
  padding: 0.34rem 0.8rem;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-edge);
}
.pill--date::before {
  /* a small verified node echo */
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(0, 149, 255, 0.6);
}
/* Tag — quieter, neutral */
.tag {
  padding: 0.3rem 0.7rem;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  border: 1px solid var(--hairline-strong);
}

/* Read button — outline pill, the landing element the user liked, in Nexus blue */
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--pill);
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    background 0.15s ease;
}
.pill-btn:hover {
  color: var(--accent);
  border-color: var(--accent-edge);
  background: var(--accent-soft);
  text-decoration: none;
}

.entry-title {
  font-weight: 200;
  font-size: clamp(1.7rem, 3.6vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 0.7rem;
  color: var(--white);
}
.entry-title a {
  color: inherit;
}
.entry-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.entry-excerpt {
  margin: 0;
  max-width: 58ch;
  color: var(--text);
}

.entry-more {
  margin-top: 1.3rem;
}

/* ---- Single entry page --------------------------------------------------- */
.entry-page {
  padding: 4rem 0 6rem;
}
.backlink {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.backlink:hover {
  color: var(--accent);
  text-decoration: none;
}
.entry-page .meta-row {
  margin-top: 2.5rem;
}
.entry-page h1 {
  font-weight: 200;
  font-size: clamp(2.1rem, 5vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--white);
  margin: 0.6rem 0 2.5rem;
}

.prose {
  font-size: 1.04rem;
}
.prose h2 {
  font-weight: 400;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 3rem 0 1rem;
}
.prose p {
  margin: 0 0 1.2rem;
  max-width: 64ch;
}
.prose ul {
  padding-left: 1.1rem;
  max-width: 64ch;
}
.prose li {
  margin-bottom: 0.4rem;
}
.prose strong {
  color: var(--white);
  font-weight: 500;
}
.prose hr {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 3rem 0;
}

/* Charts ship as 2x PNG exports (1760x920). Without a max-width they render at
 * native size and overflow the column. Fit to the column; on very narrow screens
 * the figure scrolls horizontally so the chart stays legible instead of shrinking
 * to a sliver. */
.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
  border: 1px solid var(--hairline);
  border-radius: var(--card-radius);
  background: var(--surface);
}
.prose figure {
  margin: 2rem 0;
}
.prose figure img {
  margin: 0 auto;
}
.prose figcaption {
  margin-top: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

/* Wide blocks (charts and tables) get their own scroll context so the page body
 * never scrolls sideways on mobile. */
.prose .scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6rem 0;
  font-size: 0.92rem;
}
.prose th,
.prose td {
  text-align: left;
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid var(--hairline);
}
.prose th {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.12em 0.36em;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--white);
}
.prose pre {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1.1rem;
  border: 1px solid var(--hairline);
  border-radius: var(--card-radius);
  background: var(--surface);
  font-size: 0.84rem;
  line-height: 1.55;
}
.prose blockquote {
  margin: 1.6rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 2px solid var(--accent-edge);
  color: var(--muted);
}

/* ---- Footer -------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 2.5rem 0 4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer a {
  color: var(--muted);
}

/* ---- Responsive / a11y --------------------------------------------------- */
/* Page body must never scroll sideways; only designated wide blocks (charts,
 * tables, code) scroll inside their own container. */
html,
body {
  overflow-x: hidden;
}

@media (max-width: 640px) {
  :root {
    --rail: 52px;
  }
  .masthead {
    padding: 3.5rem 0 2.5rem;
  }
  .brandline {
    margin-bottom: 2rem;
  }
  .entry {
    padding-top: 2.4rem;
    padding-bottom: 2.4rem;
    padding-right: 0.25rem;
  }
  .stat-line {
    gap: 1rem;
  }
  .site-footer {
    flex-direction: column;
    gap: 0.6rem;
  }
}

@media (max-width: 400px) {
  .entry {
    padding-right: 0;
  }
  .meta-row {
    gap: 0.4rem;
  }
  .pill--date {
    letter-spacing: 0.12em;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .entry {
    animation: rise 0.5s ease both;
  }
  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }
}

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