/* Ishmam Abid. "The Transfer": one remittance, New York to Sylhet, told on ledger paper.
   Light: eye-ease ledger green, ink, the red margin rule. Dark: banker's green baize and brass. */

:root {
  --paper: #e9eedf;
  --paper-2: #f4f6ee;
  --paper-3: #dde4d0;
  --rule: #c3d0dc;
  --ink: #182230;
  --ink-2: #4b5666;
  --ink-3: #7b8594;
  --red: #b2322a;
  --green: #1d6b4c;
  --amount: #182230;
  --coin: #c99a2e;
  --shadow: 0 1px 0 rgba(24, 34, 48, 0.06), 0 18px 40px -24px rgba(24, 34, 48, 0.35);

  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: "Xanh Mono", "Courier Prime", "Courier New", monospace;

  --rail-w: 13rem;
  --pitch: 1.75rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f201c;
    --paper-2: #152b26;
    --paper-3: #1b352f;
    --rule: #28463e;
    --ink: #ede6d3;
    --ink-2: #b3bcab;
    --ink-3: #7f8b7c;
    --red: #f07a66;
    --green: #7fcfa6;
    --amount: #dcbc72;
    --coin: #dcbc72;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 24px 48px -24px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f201c;
  --paper-2: #152b26;
  --paper-3: #1b352f;
  --rule: #28463e;
  --ink: #ede6d3;
  --ink-2: #b3bcab;
  --ink-3: #7f8b7c;
  --red: #f07a66;
  --green: #7fcfa6;
  --amount: #dcbc72;
  --coin: #dcbc72;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 24px 48px -24px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 30, "WONK" 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
@media (min-width: 900px) { body { font-size: 1.125rem; } }

h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.015em; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.16em; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 2px; }
::selection { background: color-mix(in srgb, var(--green) 30%, var(--paper)); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 1rem; top: -4rem; z-index: 60; background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; font-family: var(--mono); }
.skip:focus { top: 1rem; }

.amt, .hash, .seq, .receipt, .slip dd, .rail-amt, .rail-word, .rail-stops, .ledger-table, .hopline, figcaption, .trail-meta, .trail-hash, .loader-amt, .loader-note, .globe-caption, .exhibit-note {
  font-family: var(--mono);
  font-variation-settings: normal;
}

/* Loader: the only page-load moment. Hidden without JS and killed by CSS after 3s regardless. */
.loader { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: var(--paper); color: var(--ink); }
.no-js .loader { display: none; }
.loader-inner { display: grid; justify-items: center; gap: 0.5rem; }
.loader-amt { font-size: clamp(2.4rem, 7vw, 4.5rem); color: var(--amount); font-variant-numeric: tabular-nums; }
.loader-note { color: var(--ink-3); font-size: 0.95rem; font-style: italic; }
.loader.done { display: none; }
@keyframes loader-kill { to { opacity: 0; visibility: hidden; } }
.loader { animation: loader-kill 0.4s 3.2s forwards; }

/* Header */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.25rem 2.2rem;
  pointer-events: none;
  background: color-mix(in srgb, var(--paper) 55%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent); mask-image: linear-gradient(to bottom, #000 45%, transparent);
}
.top > * { pointer-events: auto; }
.wordmark { font-weight: 500; text-decoration: none; font-size: 1.1rem; letter-spacing: -0.01em; }
.top-right { display: flex; align-items: center; gap: 1rem; }
.top-link { text-decoration: none; font-size: 0.95rem; padding: 0.45rem 0.9rem; border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--paper) 80%, transparent); backdrop-filter: blur(8px); }
.top-link:hover { border-color: var(--ink); }

.theme { appearance: none; background: none; border: 0; padding: 0.3rem; cursor: pointer; color: inherit; }
.theme-track { display: block; width: 2.6rem; height: 1.4rem; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent); background: color-mix(in srgb, var(--paper) 80%, transparent); position: relative; backdrop-filter: blur(8px); }
.theme-knob { position: absolute; top: 0.2rem; left: 0.2rem; width: 0.9rem; height: 0.9rem; border-radius: 50%; background: var(--ink); transition: transform 0.35s var(--ease), background 0.3s; }
.theme[aria-pressed="true"] .theme-knob { transform: translateX(1.2rem); background: var(--amount); }
.no-js .theme { display: none; }
.no-js .rail-coin { display: none; }

/* Tracker rail */
.rail {
  position: fixed; z-index: 40;
  left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--rule);
}
.rail-amt { margin: 0; font-size: 1.15rem; color: var(--amount); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rail-cur { font-size: 0.75em; color: var(--ink-3); }
.rail-state { margin: 0; font-size: 1rem; color: var(--ink-2); overflow: hidden; height: 1.5em; line-height: 1.5em; justify-self: end; }
.rail-word { display: inline-block; }
.rail-line { position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--rule); }
.rail-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: var(--red); transform-origin: left; transform: scaleX(0); transition: transform 0.6s var(--ease); }
.rail-coin { display: none; }
.rail-stops { display: none; }

@media (min-width: 1100px) {
  .rail {
    inset: auto auto auto 2rem; top: 50%; transform: translateY(-50%);
    width: var(--rail-w); display: block; padding: 0; background: none; border: 0; backdrop-filter: none;
  }
  .rail-amt { font-size: 1.9rem; line-height: 1; margin-bottom: 0.3rem; }
  .rail-cur { font-size: 0.45em; display: block; margin-bottom: 0.3rem; font-style: italic; }
  .rail-state { justify-self: start; margin-bottom: 1.4rem; font-style: italic; }
  .rail-line { position: absolute; left: 0.45rem; top: 5.9rem; bottom: 0.9rem; width: 2px; height: auto; background: var(--rule); }
  .rail-fill { width: 100%; height: 100%; transform-origin: top; transform: scaleY(0); }
  .rail-coin {
    display: block; position: absolute; left: 50%; top: 0;
    width: 0.8rem; height: 0.8rem; margin-left: -0.4rem; margin-top: -0.4rem; border-radius: 50%;
    background: var(--coin); box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--coin);
    transition: top 0.7s var(--ease);
  }
  .rail-stops { display: block; list-style: none; margin: 0; padding: 0 0 0 1.6rem; font-size: 0.9rem; }
  .rail-stops li { position: relative; line-height: 1; padding: 0.55rem 0; }
  .rail-stops li::before { content: ""; position: absolute; left: -1.33rem; top: 50%; width: 0.45rem; height: 0.45rem; margin-top: -0.225rem; border-radius: 50%; background: var(--paper); border: 1.5px solid var(--rule); transition: border-color 0.3s, background 0.3s; }
  .rail-stops a { text-decoration: none; color: var(--ink-3); transition: color 0.3s; }
  .rail-stops a:hover { color: var(--ink); }
  .rail-stops a[aria-current] { color: var(--ink); }
  .rail-stops li.passed::before, .rail-stops li.active::before { background: var(--red); border-color: var(--red); }
  .rail-stops li.active a { color: var(--ink); }
  .rail-stops li:nth-child(8) a[aria-current], .rail-stops li:nth-child(8).active::before { color: var(--red); }
}

/* Page shell */
main { display: block; }
@media (min-width: 1100px) { main, .audit { padding-left: calc(var(--rail-w) + 3rem); } }

/* Hero */
.hero { min-height: 100svh; display: grid; align-items: center; padding: 6rem 1.25rem 4rem; position: relative; }
.hero-pin { width: 100%; max-width: 1180px; margin: 0 auto; display: grid; gap: 3rem; align-items: center; }
.hero-kicker { color: var(--ink-2); font-size: 0.98rem; margin-bottom: 1.6rem; }
h1 {
  font-size: clamp(2.5rem, 6.2vw, 5.1rem);
  line-height: 0.98; letter-spacing: -0.028em; font-weight: 500;
  font-variation-settings: "SOFT" 80, "WONK" 1, "opsz" 144;
  max-width: 11ch; margin-bottom: 1.4rem;
}
.lede { font-size: 1.12em; max-width: 36rem; color: var(--ink); margin-bottom: 0.8em; }
.lede-2 { max-width: 36rem; color: var(--ink-2); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; align-items: center; margin-top: 2rem; }

.btn {
  display: inline-block; text-decoration: none; background: var(--ink); color: var(--paper);
  padding: 0.85rem 1.4rem; border-radius: 999px; font-size: 0.98rem;
  transition: transform 0.4s var(--ease), background 0.3s;
  will-change: transform;
}
.btn:hover { background: var(--green); color: #fff; }
.btn.big { font-family: var(--mono); font-size: clamp(1rem, 3.6vw, 1.5rem); padding: 1rem 1.6rem; word-break: break-all; }
.btn-quiet { font-size: 0.98rem; color: var(--ink-2); }

.hero-stage { position: relative; display: grid; gap: 1.25rem; }
.slip {
  margin: 0; padding: 1rem 1.25rem 0.9rem; display: grid; gap: 0.1rem;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: 4px; box-shadow: var(--shadow);
  background-image: linear-gradient(var(--red), var(--red));
  background-size: 1px 100%; background-repeat: no-repeat; background-position: 0.8rem 0;
  font-size: 0.95rem;
  position: relative; z-index: 2;
}
.slip > div { display: grid; grid-template-columns: 6rem 1fr; gap: 0.5rem; line-height: 1.75; }
.slip dt { color: var(--ink-3); }
.slip dd { margin: 0; }
.slip .amt { color: var(--amount); font-size: 1.15em; }
.slip-state { font-style: italic; color: var(--green); }

.globe-wrap { position: relative; width: min(100%, 520px); aspect-ratio: 1; margin: 0 auto; }
.globe { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.2s ease; }
.globe.ready { opacity: 1; }
.arc-fallback { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 0.8s; }
.globe.ready + .arc-fallback { opacity: 0; }
.arc-fallback .graticule path { stroke: var(--rule); stroke-width: 1; }
.arc-fallback .arc { fill: none; stroke: var(--red); stroke-width: 2.5; stroke-dasharray: 6 8; }
.arc-fallback .city { fill: var(--ink); }
.arc-fallback .city.end { fill: var(--green); }
.arc-fallback text { font-family: var(--mono); font-size: 22px; fill: var(--ink-2); }
.globe-caption { position: absolute; left: 0; right: 0; bottom: -1.6rem; display: flex; justify-content: space-between; margin: 0; font-size: 0.85rem; color: var(--ink-3); }
.globe-wrap.small { width: min(100%, 320px); display: none; -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 48%, transparent 70%); mask-image: radial-gradient(circle at 50% 50%, #000 48%, transparent 70%); }
.globe-wrap.small:has(.globe.ready) { display: block; }

@media (min-width: 900px) {
  .hero { padding: 7rem 2.5rem 5rem; }
  .hero-pin { grid-template-columns: 1.05fr 0.95fr; gap: 3rem; }
  .hero { overflow: clip; }
  .hero-stage { display: block; height: min(72vh, 640px); }
  .hero-stage .globe-wrap { position: absolute; right: -3rem; top: 50%; transform: translateY(-52%); width: min(47vw, 680px); }
  .hero-stage .globe-caption { right: 3.5rem; }
  .slip { position: absolute; left: 0; bottom: 0; width: min(100%, 22rem); }
}
@media (min-width: 900px) and (max-width: 1300px) { .hero-stage .globe-wrap { width: 46vw; right: -2rem; } }

/* Chapters */
.chapter { padding: 5rem 1.25rem; border-top: 1px solid var(--rule); }
.chapter-inner { max-width: 1180px; margin: 0 auto; display: grid; gap: 2.5rem; }
.prose { max-width: 36rem; }
.prose p { color: var(--ink-2); }
.prose p + p { margin-top: 0; }
h2 { font-size: clamp(1.9rem, 3.4vw, 3rem); line-height: 1.04; letter-spacing: -0.022em; margin-bottom: 1.1rem; font-variation-settings: "SOFT" 60, "WONK" 1, "opsz" 96; }

.hopline { display: flex; gap: 1rem; align-items: baseline; justify-content: space-between; font-size: 0.9rem; color: var(--ink-3); margin-bottom: 1.6rem; border-bottom: 1px solid var(--rule); padding-bottom: 0.5rem; max-width: 36rem; }
.hopline .state { font-style: italic; color: var(--green); margin-right: auto; }
.branch .hopline .state { color: var(--red); }
.hopline .amt { color: var(--amount); }

.exhibit {
  margin: 0; align-self: start;
  background: var(--paper-2); border: 1px solid var(--rule); border-radius: 4px; box-shadow: var(--shadow);
  padding: 0.6rem 1.25rem 0.9rem 2.4rem; overflow: hidden;
  background-image: linear-gradient(var(--red), var(--red));
  background-size: 1px 100%;
  background-repeat: no-repeat;
  background-position: 1.6rem 0;
}
.exhibit figcaption { font-size: 0.85rem; color: var(--ink-3); line-height: var(--pitch); font-style: italic; border-bottom: 1px solid var(--rule); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.receipt { margin: 0; font-size: 0.88rem; line-height: var(--pitch); white-space: pre; overflow-x: auto; color: var(--ink); tab-size: 4; }
.receipt .ln { display: block; border-bottom: 1px solid var(--rule); }
.exhibit tr { border-bottom: 1px solid var(--rule); }
.receipt .k, .ledger-table th { color: var(--ink-3); font-weight: 400; }
.ok { color: var(--green); }
.bad { color: var(--red); }
.dim { color: var(--ink-3); }
.del { color: var(--red); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--red) 60%, transparent); }
.add { color: var(--green); }
.sum { color: var(--amount); border-top: 1px solid var(--ink-3); }
.exhibit table { border-collapse: collapse; width: 100%; font-size: 0.88rem; line-height: var(--pitch); }
.exhibit th, .exhibit td { padding: 0; text-align: left; vertical-align: baseline; white-space: nowrap; }
.exhibit .num { text-align: right; font-variant-numeric: tabular-nums; padding-left: 1rem; }
.ledger-table thead tr { border-bottom: 1px solid var(--ink-3); }
.ledger-table tbody .num { color: var(--amount); }
.ledger-table tfoot .sum { border-top: 1px solid var(--ink-3); }
.ledger-table .chain th, .ledger-table .chain td { color: var(--ink-3); }
.exhibit tfoot tr:last-child, .exhibit tbody tr:last-child { border-bottom: 0; }
.receipt .ln:last-child { border-bottom: 0; }
.hash { letter-spacing: 0.02em; }
.exhibit-note { margin: 0.5rem 0 0; font-size: 0.8rem; color: var(--ink-3); line-height: 1.4; white-space: normal; }

@media (min-width: 900px) {
  .chapter { padding: 7rem 2.5rem; }
  .chapter-inner { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 4rem; align-items: start; }
  .exhibit { position: sticky; top: 6rem; }
}

/* Scrubbed exhibits: JS sets the "armed" class; without JS they sit in their final state. */
.js .exhibit.armed .ln { opacity: 0.12; transform: translateX(-0.35rem); }
.js .exhibit.armed .ln.on { opacity: 1; transform: none; transition: opacity 0.35s, transform 0.5s var(--ease); }

/* Delivered */
.delivered { padding: 7rem 1.25rem 5rem; border-top: 1px solid var(--rule); text-align: center; }
.delivered-inner { max-width: 40rem; margin: 0 auto; display: grid; justify-items: center; gap: 1rem; }
.delivered .hopline { width: 100%; }
.delivered h2 { font-size: clamp(2.6rem, 7vw, 5rem); font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; }
.delivered-text { color: var(--ink-2); max-width: 30rem; font-size: 1.08em; }

/* Contact */
.contact { padding: 5rem 1.25rem 7rem; }
.contact-inner { max-width: 1180px; margin: 0 auto; }
.contact h2 { max-width: 20ch; font-size: clamp(1.9rem, 3.8vw, 3.2rem); }
.contact-sub { color: var(--ink-2); max-width: 36rem; margin-top: 1rem; }
.contact-main { margin: 2rem 0 1.5rem; }
.contact-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; font-family: var(--mono); font-size: 0.98rem; }

/* Audit trail */
.audit { background: var(--paper-3); border-top: 1px solid var(--rule); padding: 5rem 1.25rem 7rem; }
.audit-inner { max-width: 1180px; margin: 0 auto; }
.audit h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
.audit-sub { color: var(--ink-2); max-width: 36rem; margin: 0.6rem 0 2.5rem; }
.trail { list-style: none; margin: 0 0 3.5rem; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--rule); }
.trail li { display: grid; gap: 0.35rem; padding: 1.4rem 0 1.5rem; border-bottom: 1px solid var(--rule); }
.trail-meta { margin: 0; font-size: 0.85rem; color: var(--ink-3); display: flex; gap: 1rem; }
.trail .seq { color: var(--red); }
.trail h3 { font-size: 1.2rem; }
.trail li > p:not(.trail-meta):not(.trail-hash) { color: var(--ink-2); margin: 0; max-width: 40rem; }
.trail-hash { margin: 0.4rem 0 0; font-size: 0.82rem; color: var(--ink-3); display: flex; gap: 0.6rem; align-items: baseline; }
.trail-hash .hash + .hash::before { content: "→ "; }
.trail-hash .hash:last-child { color: var(--ink); }
.trail li:last-child .trail-hash .hash:last-child { color: var(--green); }
@media (min-width: 900px) {
  .trail li { grid-template-columns: 12rem 1fr 11rem; grid-template-rows: auto auto; gap: 0.4rem 2rem; align-items: baseline; }
  .trail li > h3 { grid-column: 2; grid-row: 1; }
  .trail-meta { grid-column: 1; grid-row: 1 / span 2; flex-direction: column; gap: 0.2rem; align-self: start; }
  .trail li > p:not(.trail-meta):not(.trail-hash) { grid-column: 2; grid-row: 2; }
  .trail-hash { grid-column: 3; grid-row: 1 / span 2; flex-direction: column; justify-self: end; align-self: start; text-align: right; margin: 0; }
  .trail-hash .hash + .hash::before { content: "↳ "; }
}
.record { display: grid; gap: 2rem; margin-bottom: 3rem; }
.record h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.record ul { margin: 0; padding: 0; list-style: none; color: var(--ink-2); }
.record li { margin-bottom: 0.6rem; max-width: 36rem; }
@media (min-width: 900px) { .record { grid-template-columns: 1fr 1fr 1fr; gap: 3rem; } }
.colophon { font-size: 0.9rem; color: var(--ink-3); max-width: 60rem; margin: 0; }

/* Cursor (fine pointers only, after JS arms it) */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  .has-cursor .cursor { display: block; position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; opacity: 0; transition: opacity 0.3s; }
  .has-cursor.cursor-live .cursor { opacity: 1; }
  .cursor-dot { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
  .cursor-ring { position: absolute; left: -16px; top: -16px; width: 32px; height: 32px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--ink) 55%, transparent); transition: transform 0.35s var(--ease), border-color 0.3s, background 0.3s; }
  .has-cursor.cursor-link .cursor-ring { transform: scale(1.8); border-color: transparent; background: color-mix(in srgb, var(--green) 18%, transparent); }
  .has-cursor.cursor-link .cursor-dot { background: var(--green); }
}

/* Split-text masks: JS wraps lines in .line-mask > .line */
.line-mask { display: block; overflow: hidden; padding-bottom: 0.06em; margin-bottom: -0.06em; }

/* Reduced motion: everything readable, nothing moving */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .loader { display: none; }
  .globe { transition: none; }
  .rail-fill, .rail-coin, .theme-knob, .btn, .cursor-ring { transition: none; }
  .js .exhibit.armed .ln { opacity: 1; transform: none; }
}

/* Short viewports: let the sticky exhibit scroll naturally */
@media (min-width: 900px) and (max-height: 700px) { .exhibit { position: static; } }

/* Narrow: keep the receipts readable, never overflow the page */
@media (max-width: 480px) {
  .receipt, .exhibit table { font-size: 0.78rem; }
  .exhibit { padding-left: 1.9rem; background-position: 1.2rem 0; }
  .exhibit td:first-child, .exhibit th[scope="row"] { white-space: normal; overflow-wrap: anywhere; }
  .exhibit .num { padding-left: 0.6rem; }
  .slip > div { grid-template-columns: 5rem 1fr; }
  .hopline { flex-wrap: wrap; }
}
