.wrap { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.small { font-size: 0.82rem; }
.muted { color: var(--muted); }
.right { text-align: right; }
.label { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }

/* Masthead */
.masthead { position: sticky; top: 0; z-index: 10; background: rgba(246, 243, 236, 0.9); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; transition: border-color 0.2s ease; }
.masthead.solid { border-bottom-color: var(--rule); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 0.92rem; }
.nav-links a { text-decoration: none; color: var(--ink-soft); }
.nav-links a:hover { color: var(--ink); }
.nav-links .nav-app { color: var(--blue); font-weight: 600; }

/* Hero */
.hero { display: grid; grid-template-columns: 1fr 1.02fr; gap: 64px; align-items: center; padding: 72px 0 96px; }
.dateline { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.hero h1 { margin-top: 18px; font-family: var(--serif); font-weight: 400; font-size: clamp(2.8rem, 5.6vw, 4.6rem); line-height: 1.02; letter-spacing: -0.02em; }
.hero h1 em { color: var(--blue); }
.lede { margin-top: 22px; max-width: 470px; font-size: 1.12rem; color: var(--ink-soft); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }

/* The invoice */
.sheet-wrap { margin: 0; }
.sheet { position: relative; padding: 30px 32px 26px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; box-shadow: 0 1px 0 var(--rule-soft), 0 24px 48px -28px rgba(22, 24, 29, 0.35); transform: rotate(-0.6deg); }
.sheet-head { display: flex; justify-content: space-between; padding-bottom: 16px; border-bottom: 2px solid var(--ink); }
.sheet-title { font-family: var(--serif); font-size: 2rem; line-height: 1; }
.parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px 0; font-size: 0.92rem; }
.lines { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.lines th { text-align: left; font-weight: 500; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); padding: 6px 0; border-bottom: 1px solid var(--rule); }
.lines td { padding: 9px 0; border-bottom: 1px solid var(--rule-soft); }
.lines tfoot td { padding-top: 12px; border-bottom: 0; font-weight: 700; font-size: 1rem; }
.num { text-align: right; }
.approved { margin-top: 14px; color: var(--green); }
.tick { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px; border-radius: 50%; background: var(--green-wash); font-size: 0.7rem; }
.stamp { position: absolute; right: 22px; bottom: 8px; display: grid; justify-items: center; padding: 8px 16px 6px; border: 3px double var(--blue); border-radius: 6px; color: var(--blue); font-family: var(--serif); font-size: 1.45rem; line-height: 1; text-transform: uppercase; background: rgba(255, 253, 248, 0.85); letter-spacing: 0.04em; transform: rotate(-11deg) scale(1.5); opacity: 0; mix-blend-mode: multiply; transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.2, 1.5, 0.4, 1); }
.stamp span { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.3em; margin-top: 4px; }
.scene-done .stamp { opacity: 0.92; transform: rotate(-11deg) scale(1); }

.ledger { list-style: none; margin: 22px 8px 0; padding: 0; border-top: 1px solid var(--ink); }
.row { display: grid; grid-template-columns: 110px 1fr; grid-template-areas: "who state"; align-items: center; padding: 11px 4px; border-bottom: 1px solid var(--rule); font-size: 0.9rem; transition: background 0.4s ease, color 0.4s ease; }
.who { grid-area: who; font-weight: 600; }
.state { grid-area: state; text-align: right; transition: opacity 0.35s ease; }
.s-offer { color: var(--muted); }
.s-win, .s-lose { opacity: 0; }
.scene-paying .row-a .s-offer::after { content: " · paying…"; color: var(--blue); }
.scene-done .s-offer { opacity: 0; }
.scene-done .s-win, .scene-done .s-lose { opacity: 1; }
.scene-done .row-a { background: var(--blue-wash); }
.scene-done .row-a .s-win { color: var(--blue-deep); font-weight: 600; }
.scene-done .row-b, .scene-done .row-c { color: var(--faint); }
.scene-done .row-b .who, .scene-done .row-c .who { text-decoration: line-through; text-decoration-color: var(--rule); }

/* Sections */
.section { padding: 96px 0; border-top: 1px solid var(--rule); }
.section h2, .closing h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 3.8vw, 3rem); line-height: 1.08; letter-spacing: -0.015em; }
.section p { color: var(--ink-soft); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 72px; align-items: center; }
.split p { margin-top: 18px; max-width: 480px; }
.section-lede { margin-top: 14px; max-width: 560px; }

.ledger-table { width: 100%; border-collapse: collapse; font-size: 0.98rem; background: var(--sheet); border: 1px solid var(--rule); }
.ledger-table td { padding: 14px 18px; border-bottom: 1px solid var(--rule-soft); }
.ledger-table .sum td { border-top: 2px solid var(--ink); font-weight: 600; }
.ledger-table .loss td { color: var(--red); font-weight: 700; background: var(--red-wash); border-bottom: 0; }

.numbered { list-style: none; margin: 44px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 64px; }
.numbered li { display: grid; grid-template-columns: 56px 1fr; padding: 26px 0; border-top: 1px solid var(--rule); }
.n { font-family: var(--serif); font-size: 2.4rem; line-height: 1; color: var(--blue); }
.numbered h3 { font-size: 1.08rem; font-weight: 600; }
.numbered p { margin-top: 6px; }

.seen { background: var(--paper-deep); }
.views { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 44px; }
.view { margin: 0; }
.mini { padding: 20px 22px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; }
.mini-title { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--ink); font-family: var(--mono); font-size: 0.86rem; }
.mini dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 14px 0 0; font-size: 0.9rem; }
.mini dt { color: var(--muted); }
.mini dd { margin: 0; text-align: right; font-weight: 600; }
.tag { padding: 2px 8px; border-radius: 3px; font-family: var(--sans); font-size: 0.72rem; font-weight: 600; background: var(--rule-soft); color: var(--muted); }
.tag-green { background: var(--green-wash); color: var(--green); }
.redact { position: relative; color: transparent; }
.redact::after { content: ""; position: absolute; inset: 1px -3px; background: var(--ink); border-radius: 1px; transform-origin: left; transform: scaleX(0); transition: transform 0.6s ease 0.3s; }
.shown .redact::after { transform: scaleX(1); }
.view figcaption { margin-top: 14px; font-size: 0.93rem; color: var(--ink-soft); }

.log { padding: 26px 28px; background: var(--ink); color: #d9dce3; border-radius: 4px; }
.log-head { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid #343842; color: #8e939e; font-size: 0.78rem; }
.log ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 0.84rem; }
.log li { opacity: 0; transform: translateX(-6px); transition: opacity 0.3s ease, transform 0.3s ease; }
.log li::before { content: "› "; color: #6b707b; }
.log li.ok { color: #8fd3a8; }
.log li.ok::before { content: "✓ "; }
.log li.no { color: #f0a198; }
.log li.no::before { content: "✕ "; }
.log li.muted-line { color: #8e939e; }
.log li.on { opacity: 1; transform: none; }
.text-link { display: inline-block; margin-top: 22px; color: var(--blue); font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.who-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px; margin-top: 40px; }
.who-row > div { padding-top: 18px; border-top: 2px solid var(--ink); }
.who-row h3 { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; }
.who-row p { margin-top: 8px; }

.closing { padding: 96px 0 110px; border-top: 1px solid var(--rule); text-align: center; }
.closing-inner p { margin: 16px auto 30px; max-width: 520px; color: var(--ink-soft); }

.footer { border-top: 1px solid var(--rule); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 26px 0; }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.shown { opacity: 1; transform: none; }

@media (max-width: 920px) {
  .hero, .split { grid-template-columns: 1fr; gap: 48px; }
  .hero { padding-top: 40px; }
  .numbered, .views, .who-row { grid-template-columns: 1fr; }
  .nav-links a:not(.nav-app) { display: none; }
}
@media (max-width: 520px) {
  .sheet { padding: 22px 18px; transform: none; }
  .stamp { bottom: 12px; right: 14px; font-size: 1.3rem; }
  .row { grid-template-columns: 84px 1fr; font-size: 0.82rem; }
}

/* Entrance: the invoice settles onto the desk, the headline rises line by line. */
.sheet { animation: settle-sheet 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both 0.15s; }
@keyframes settle-sheet { from { opacity: 0; transform: translateY(18px) rotate(-2.5deg); } to { opacity: 1; transform: rotate(-0.6deg); } }
.ledger { animation: fade-up 0.6s ease both 0.7s; }
.rise > * { display: inline-block; animation: fade-up 0.7s ease both; }
.rise > :nth-child(2) { animation-delay: 0.12s; }
.rise > :nth-child(3) { animation-delay: 0.26s; }
.lede, .hero-actions, .dateline { animation: fade-up 0.7s ease both 0.4s; }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } }

/* Lender A's payment fills a thin bar under its row. */
.row { position: relative; }
.pay-bar { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--blue); }
.scene-paying .pay-bar { width: 100%; transition: width 1.1s ease-in-out; }
.scene-done .pay-bar { width: 100%; }

/* The loss table fills in row by row. */
.ledger-table tr { opacity: 0; transform: translateX(8px); transition: opacity 0.4s ease, transform 0.4s ease; }
.ledger-table.shown tr { opacity: 1; transform: none; }
.ledger-table.shown tr:nth-child(2) { transition-delay: 0.12s; }
.ledger-table.shown tr:nth-child(3) { transition-delay: 0.24s; }
.ledger-table.shown tr:nth-child(4) { transition-delay: 0.36s; }
.ledger-table.shown tr:nth-child(5) { transition-delay: 0.5s; }
.ledger-table.shown tr:nth-child(6) { transition-delay: 0.7s; }

/* Inside the app */
.inside { background: var(--paper-deep); }
.browser { margin: 40px 0 0; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--sheet); box-shadow: 0 30px 60px -36px rgba(22, 24, 29, 0.45); }
.browser-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 1px solid var(--rule); background: var(--paper); }
.browser-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--rule); }
.browser-bar p { margin-left: 12px; padding: 3px 12px; border-radius: 4px; background: var(--sheet); border: 1px solid var(--rule-soft); font-size: 0.75rem; color: var(--muted); }
.browser img { display: block; width: 100%; height: auto; }

/* Who it's for: line icons and rules that draw across. */
.who-icon { width: 30px; height: 30px; margin-bottom: 12px; fill: none; stroke: var(--blue); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.who-row > div { position: relative; border-top: 0; }
.who-row > div::before { content: ""; position: absolute; left: 0; top: 0; height: 2px; width: 100%; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform 0.9s ease 0.15s; }
.who-row > div.shown::before { transform: scaleX(1); }
