/* The Ledger — darwinb.com */

@font-face {
  font-family: "Ledger Receipt";
  src: url("assets/fonts/departure-mono.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --env: #ffffff;
  --paper: #ffffff;
  --ink: #111111;
  --graphite: #444440;
  --faint: #71716d;
  --hairline: #deded8;
  --activity-panel: #f6f6f2;
  --activity-empty: #e8e8e3;
  --activity-axis: #71716d;
  --accent: #1f4fff;
  --negative: #c93d32;
  --positive: #167a4d;
  --print-shadow: 0 0 0.3px rgba(17, 17, 17, 0.34);
}

html.dark {
  --env: #050505;
  --paper: #050505;
  --ink: #f1f0e9;
  --graphite: #b1b0aa;
  --faint: #777772;
  --hairline: #272727;
  --activity-panel: #090909;
  --activity-empty: #242424;
  --activity-axis: #777772;
  --accent: #4d6dff;
  --negative: #e66a5c;
  --positive: #51b989;
  --print-shadow: 0 0 0.45px rgba(241, 240, 233, 0.2);
}

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

html {
  font-size: 120%;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  font-family: "Ledger Receipt", "OCR B", "SF Mono", monospace;
  background: var(--env);
  color: var(--ink);
  font-size: 0.75rem;
  line-height: 1.5;
  letter-spacing: 0;
  transition: background-color 0.35s ease, color 0.35s ease;
}

::selection { background: var(--accent); color: #fff; }

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

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 44px 96px;
}

/* ── Site chrome ─────────────────────────────── */

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 44px;
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 400;
}

.site-nav .brand { color: var(--ink); }
html.dark .site-nav .brand { color: #EDEDED; }

.site-nav nav { display: flex; align-items: baseline; }

.site-nav nav a { margin-left: 20px; color: var(--graphite); }
html.dark .site-nav nav a { color: #8A8A8A; }
.site-nav nav a:hover { color: var(--accent); text-decoration: none; }

.theme-toggle {
  margin-left: 20px;
  background: none;
  border: 1px solid var(--hairline);
  color: var(--graphite);
  font-family: inherit;
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 8px;
  cursor: pointer;
}
html.dark .theme-toggle { border-color: #262626; color: #8A8A8A; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* ── Receipt paper ───────────────────────────── */

.receipt-paper {
  background: var(--paper);
  color: var(--ink);
  transition: background-color 0.35s ease, color 0.35s ease;
}

/* ── Masthead ────────────────────────────────── */

.masthead { margin-bottom: 48px; }
html.dark .masthead { color: #EDEDED; }

.masthead h1 {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}

.masthead .tagline { color: var(--graphite); max-width: 52ch; }
html.dark .masthead .tagline { color: #8A8A8A; }

/* ── Master statement ────────────────────────── */

.master-wrap {
  max-width: 640px;
  margin: 0 auto;
}

.master {
  padding: 48px 52px 46px;
  text-shadow: var(--print-shadow);
}

.m-header { margin-bottom: 38px; }

.m-title,
.m-account {
  font-size: 0.75rem;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: uppercase;
}

.m-thesis {
  margin: 0 0 56px;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: var(--graphite);
  max-width: 44ch;
}

.m-items { width: 100%; }
.m-section { padding: 0; }

.m-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: baseline;
  min-height: 28px;
  padding: 5px 0;
  font-size: 0.75rem;
  line-height: 1.5;
  text-transform: uppercase;
}

.m-label {
  min-width: 0;
  font-weight: 400;
  letter-spacing: 0;
}

.m-result {
  display: inline-flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 8px;
  color: var(--ink);
  font-weight: 400;
  letter-spacing: 0;
  white-space: nowrap;
}

a.m-result:hover { color: var(--accent); text-decoration: none; }
.m-arrow { color: var(--accent); font-size: 0.75em; }
.m-line.m-primary .m-arrow { font-weight: 700; }

.m-balance { margin-top: 12px; }
.m-total { color: var(--accent); font-weight: 400; }
.master .r-footer { margin-top: 52px; }

@media (max-width: 640px) {
  .wrap { padding: 24px 20px 72px; }
  .site-nav { margin-bottom: 34px; font-size: 0.625rem; }
  .site-nav .brand { white-space: nowrap; flex-shrink: 0; }
  .site-nav nav a { margin-left: 10px; }
  .theme-toggle { margin-left: 10px; padding: 3px 6px; font-size: 0.5625rem; }
  .master { padding: 32px 4px 38px; }
  .m-header { margin-bottom: 32px; }
  .m-line { gap: 12px; font-size: 0.6875rem; min-height: 19px; }
  .m-title, .m-account { font-size: 0.6875rem; }
  .master .r-footer { margin-top: 46px; }
}

/* ── Homepage evidence system ────────────────── */

.home-shell { display: block; }

.channel-rail {
  max-width: 640px;
  margin: 18px auto 0;
  padding: 14px 0;
  border-top: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--graphite);
  font-size: 0.625rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.channel-rail a,
.channel-rail > span { color: inherit; white-space: nowrap; }
.channel-rail a:hover { color: var(--accent); text-decoration: none; }
.channel-rail .is-pending { color: var(--faint); }
.channel-mark { color: var(--accent); margin-right: 7px; }

.settlements-section {
  max-width: 1120px;
  margin: 120px auto 0;
  scroll-margin-top: 32px;
}

.section-head {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  text-transform: uppercase;
}

.section-head h2 {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.1em;
}

.section-head p,
.section-head > a {
  margin-top: 4px;
  color: var(--faint);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
}

.section-head > a:hover { color: var(--accent); text-decoration: none; }

.settlement-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}

.settlement {
  width: min(720px, 100%);
  padding: 40px 36px 38px;
  display: flex;
  flex-direction: column;
  text-shadow: var(--print-shadow);
  border: 1px solid var(--hairline);
}

.set-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.set-kind,
.set-title,
.set-line,
.set-total {
  text-transform: uppercase;
}

.set-kind { font-size: 0.75rem; color: var(--accent); }
.set-date { margin-top: 2px; font-size: 0.75rem; color: var(--faint); }

.set-title {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  margin-top: 30px;
}

.set-line {
  min-height: 23px;
  padding: 3px 0 5px;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: start;
  gap: 24px;
  color: var(--ink);
  font-size: 0.75rem;
}
.set-line:hover { color: var(--accent); text-decoration: none; }
.set-label,
.set-value { min-width: 0; }
.set-value { text-align: right; }

.set-total {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

.settlement .r-footer { margin-top: auto; padding-top: 52px; }

/* ── Social format preview ───────────────────── */

.share-body { min-width: 320px; background: #0a0a0a; color: #f3f2ec; }
.share-preview { max-width: 1600px; margin: 0 auto; padding: 32px; }
.share-preview-head {
  padding-bottom: 20px;
  margin-bottom: 36px;
  border-bottom: 1px solid #2a2a2a;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  color: #858580;
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.share-preview-head a { color: #f3f2ec; }
.share-formats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(240px, 0.72fr);
  gap: 32px;
  align-items: start;
}
.social-card {
  width: 100%;
  padding: 32px;
  border: 1px solid #2e2e2e;
  background: #050505;
  color: #f3f2ec;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-shadow: 0 0 0.45px rgba(243, 242, 236, 0.2);
}
.social-card[data-format="square"] { aspect-ratio: 1 / 1; }
.social-card[data-format="portrait"] { aspect-ratio: 4 / 5; }
.social-card[data-format="story"] { aspect-ratio: 9 / 16; }
.social-top,
.social-bottom,
.social-line {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  text-transform: uppercase;
}
.social-top,
.social-bottom { font-size: 0.5625rem; color: #8c8c86; }
.social-kicker { margin-bottom: 14px; color: #4d6dff; font-size: 0.625rem; }
.social-core h2 {
  max-width: 18ch;
  font-size: clamp(1rem, 2vw, 1.625rem);
  font-weight: 400;
  line-height: 1.25;
  text-transform: uppercase;
}
.social-lines { margin-top: 28px; }
.social-line { padding: 3px 0; font-size: 0.625rem; }
.social-line span:last-child { text-align: right; }

.home-share-formats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(210px, 0.72fr);
  gap: 28px;
  align-items: start;
}

.home-share-formats .social-card { padding: 24px; }
.home-share-formats .social-core h2 { font-size: clamp(0.8125rem, 1.55vw, 1.125rem); }
.home-share-formats .social-line { font-size: 0.5rem; }
.home-share-formats .social-top,
.home-share-formats .social-bottom { font-size: 0.5rem; }

.closing-balance {
  max-width: 1120px;
  margin: 120px auto 0;
  padding: 28px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  text-transform: uppercase;
}

.closing-balance span {
  display: block;
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 0.5625rem;
  letter-spacing: 0.08em;
}

.closing-balance strong {
  display: block;
  max-width: 44ch;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.closing-balance a {
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .channel-rail {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px 18px;
  }
  .settlements-section { margin-top: 76px; }
  .section-head { align-items: flex-start; }

  .settlement-stack { gap: 40px; }
  .settlement { padding: 38px 20px 42px; }

  .set-line {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
    padding: 6px 0 8px;
    font-size: 0.6875rem;
  }
  .set-value { text-align: left; color: var(--graphite); }

  .share-formats,
  .home-share-formats { grid-template-columns: 1fr; }
  .share-preview { padding: 20px; }
  .share-preview-head { flex-direction: column; }
  .social-card[data-format="story"],
  .home-share-formats .social-card[data-format="story"] { width: min(320px, 100%); justify-self: center; }
  .closing-balance {
    margin-top: 76px;
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ── The receipt (ledger entries) ────────────── */

.receipt {
  padding: 48px 44px 42px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  transition: background-color 0.45s ease;
}

a.receipt-link { display: block; color: inherit; }
a.receipt-link:hover { text-decoration: none; }
a.receipt-link:hover .receipt { color: var(--ink); }

.receipt .r-head { padding: 0; margin-bottom: 32px; }

.receipt .r-title {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.receipt .r-sub {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--graphite);
  margin-top: 3px;
}

.receipt .r-blurb { display: none; }

.receipt .r-items { flex: 1; }

.r-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 0;
}

.r-line .lbl { color: var(--ink); font-weight: 400; text-transform: uppercase; letter-spacing: 0.02em; }
.r-line .val { font-weight: 400; text-align: right; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.02em; }
.r-line .val.positive { color: var(--positive); font-weight: 400; }
.r-line .val.negative { color: var(--negative); font-weight: 400; }
.r-line .val.accent { color: var(--accent); font-weight: 400; }

.receipt .r-total {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 0;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.r-total .lbl { color: var(--faint); }
.r-total .val { color: var(--accent); font-weight: 400; }

html.dark .r-total .val { text-shadow: 0 0 18px rgba(31, 79, 255, 0.4); }

.r-footer {
  margin-top: 36px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.receipt .r-footer { margin-top: 56px; }

.r-sig .sig-mark {
  font-family: "Caveat", cursive;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 0.82;
  color: var(--ink);
  transform: rotate(-4deg);
  transform-origin: left center;
}

.r-sig .sig-label {
  font-size: 0.625rem;
  line-height: 1.4;
  letter-spacing: 0.05em;
  color: var(--ink);
  text-transform: uppercase;
  margin-top: 13px;
}

.r-logo { text-align: right; line-height: 1.15; }

.r-logo .logo-mark { font-size: 1.25rem; font-weight: 400; color: var(--ink); }

.r-logo .logo-sub {
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  color: var(--ink);
  text-transform: uppercase;
}

.r-logo .logo-addr {
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-transform: uppercase;
  margin-top: 4px;
}

.receipt .r-status {
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  color: var(--faint);
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ── Ledger scroll + printer feed ────────────── */

.scroll { max-width: 640px; margin: 0 auto; }

.scroll-entry { margin-bottom: 72px; }

.scroll-date {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--faint);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.feed-slot { position: relative; }
.feed-slot::after { content: none; }
.feed { overflow: visible; padding-top: 0; }
.feed-inner { transform: none; transition: none; }
.feed.revealed .feed-inner { transform: none; }

/* ── Manifesto ───────────────────────────────── */

.manifesto { max-width: 640px; margin: 0 auto; }

.manifesto .m-lines {
  padding-bottom: 32px;
  margin-bottom: 32px;
  border-bottom: 1px dashed var(--hairline);
}

.manifesto .m-lines p { margin: 0; }

/* ── Footer ──────────────────────────────────── */

.site-footer {
  margin-top: 128px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  display: flex;
  justify-content: space-between;
}
html.dark .site-footer { border-color: #262626; }

/* The index is the artifact; do not append conventional site chrome beneath it. */
.master-wrap + .site-footer { display: none; }

/* ── Motion preferences ──────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .feed-inner { transform: none !important; }
}

/* ── Master vertical social stack ─────────────── */
.master-socials {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 28px;
  padding-top: 18px;
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.master-socials .social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--graphite);
}
.master-socials .social-link:hover { color: var(--accent); text-decoration: none; }
.master-socials .social-mark { color: var(--accent); font-weight: 400; }
.master-socials .is-pending { color: var(--faint); }

/* ── Content Profile page ───────────────────── */
.cp-install {
  margin: 34px 0 8px;
  padding: 22px 0 18px;
  border-top: 1px dashed var(--hairline);
  border-bottom: 1px dashed var(--hairline);
}
.cp-install-head {
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}
.cp-step { margin: 0 0 14px; }
.cp-comment {
  display: block;
  font-size: 0.6875rem;
  color: var(--faint, #6B6B6B);
  margin-bottom: 3px;
}
.cp-cmd {
  display: block;
  font-size: 0.6875rem;
  line-height: 1.6;
  color: var(--ink);
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.cp-cmd::-webkit-scrollbar { display: none; }
.cp-note {
  font-size: 0.6875rem;
  line-height: 1.6;
  color: var(--faint, #6B6B6B);
  margin: 14px 0 0;
}
.cp-cta { margin: 26px 0 6px; }
.cp-cta a {
  display: block;
  text-align: center;
  padding: 12px 10px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-decoration: none;
}
.cp-cta a:hover { background: var(--accent); color: var(--paper); text-decoration: none; }
.cp-disclosure { margin-top: 18px; }

/* label links (e.g. X → profile) keep receipt ink, accent on hover */
a.m-label { color: inherit; text-decoration: none; }
a.m-label:hover { color: var(--accent); }

/* opt-out of the line uppercase for brand casing (e.g. beehiiv) */
.m-label.keep-case { text-transform: none; }
