/* dilucid — "The Dilution Ledger": a financial broadsheet for SEC dilution events.
   Warm newsprint · Fraunces masthead · IBM Plex Mono ledger · oxblood + gold. */

:root {
  --paper:    #f4efe2;
  --paper-2:  #efe8d6;
  --ink:      #1d1813;
  --ink-soft: #4b4239;
  --muted:    #8a7f6b;
  --rule:     #d8cdb4;
  --rule-2:   #c8bb9c;

  --oxblood:  #8e2f1c;
  --oxblood-2:#b04524;
  --gold:     #97701c;
  --slate:    #54636a;
  --plum:     #6c3a64;
  --fail:     #aa241b;

  --shadow:   0 1px 0 rgba(255,255,255,.5), 0 18px 40px -28px rgba(40,28,16,.55);
  --pad:      clamp(18px, 4vw, 56px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.5;
  /* faint vertical ledger columns + paper warmth */
  background-image:
    repeating-linear-gradient(90deg, transparent 0 calc(12.5% - 1px),
      rgba(140,120,90,.045) calc(12.5% - 1px) 12.5%),
    radial-gradient(120% 80% at 50% -10%, rgba(255,250,238,.7), transparent 60%);
  background-attachment: fixed;
}

/* film grain overlay */
.grain {
  position: fixed; inset: 0; z-index: 999; pointer-events: none; opacity: .42;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

/* ---------- masthead ---------- */
.masthead { padding: clamp(28px, 5vw, 60px) var(--pad) 0; max-width: 1320px; margin: 0 auto; }
.mast-top {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: .22em;
  color: var(--oxblood); text-transform: uppercase;
  border-bottom: 1.5px solid var(--ink); padding-bottom: 8px;
}
.mast-top .issue { color: var(--ink-soft); letter-spacing: .14em; }
.wordmark {
  font-family: "Fraunces", serif; font-optical-sizing: auto;
  font-weight: 600; font-size: clamp(56px, 13vw, 150px); line-height: .9;
  letter-spacing: -.03em; margin: 14px 0 0; color: var(--ink);
}
.wordmark::after { content: "."; color: var(--oxblood); }
.lede {
  font-size: clamp(15px, 1.6vw, 19px); color: var(--ink-soft);
  max-width: 58ch; margin: 14px 0 0;
}
.lede em { font-style: italic; color: var(--ink); }
.hr {
  height: 4px; margin: 22px 0 0;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
  transform-origin: left; animation: draw .9s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- controls ---------- */
.controls {
  max-width: 1320px; margin: 0 auto; padding: 18px var(--pad) 4px;
  display: flex; gap: 18px; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
}
.ticker { display: flex; flex-wrap: wrap; gap: 2px; }
.tick {
  display: inline-flex; align-items: baseline; gap: 7px;
  font-family: "IBM Plex Mono", monospace; font-size: 12.5px;
  padding: 7px 14px; cursor: pointer; color: var(--ink-soft);
  border-bottom: 2px solid transparent; user-select: none;
  transition: color .15s, border-color .15s, background .15s;
}
.tick:hover { color: var(--ink); background: rgba(142,47,28,.05); }
.tick .n { font-weight: 600; font-size: 15px; color: var(--ink); }
.tick .k { letter-spacing: .12em; text-transform: uppercase; font-size: 10.5px; }
.tick .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--muted)); align-self: center; }
.tick.on { border-color: var(--c, var(--oxblood)); color: var(--ink); background: rgba(142,47,28,.06); }
.tick.total { color: var(--oxblood); }
.tick.total .n { color: var(--oxblood); }

.window {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: "IBM Plex Mono", monospace; font-size: 11px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.window select {
  font-family: "IBM Plex Mono", monospace; font-size: 13px; letter-spacing: 0;
  text-transform: none; color: var(--ink); background: var(--paper-2);
  border: 1px solid var(--rule-2); border-radius: 2px; padding: 7px 10px; cursor: pointer;
}
.window select:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 1px; }

/* ---------- ledger table ---------- */
main { max-width: 1320px; margin: 0 auto; padding: 10px var(--pad) 40px; }
.ledger { width: 100%; border-collapse: collapse; }
.ledger thead th {
  font-family: "IBM Plex Mono", monospace; font-weight: 500; font-size: 11px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
  text-align: left; padding: 10px 14px; border-bottom: 1.5px solid var(--ink);
  position: sticky; top: 0; background: var(--paper); z-index: 2;
}
.ledger th.num { text-align: right; }
.ledger th.sortable { cursor: pointer; }
.ledger th.sortable:hover { color: var(--ink); }
.ledger th .car { color: var(--oxblood); margin-left: 5px; }

.ledger tbody tr {
  border-bottom: 1px solid var(--rule);
  animation: rise .5s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ledger tbody tr:hover { background: rgba(142,47,28,.045); }
.ledger td { padding: 13px 14px; vertical-align: baseline; }

.c-date { font-family: "IBM Plex Mono", monospace; font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
.c-date .dd { display: block; color: var(--muted); font-size: 11px; }

.ledger tbody tr.has-detail { cursor: pointer; }
.issuer { font-family: "Fraunces", serif; font-size: 18px; font-weight: 500; line-height: 1.15; }
.issuer .caret {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--muted);
  margin-left: 8px; display: inline-block; transition: transform .15s, color .15s;
}
.ledger tbody tr.has-detail:hover .caret { color: var(--oxblood); }
.ledger tbody tr.open .caret { transform: rotate(90deg); color: var(--oxblood); }

/* expandable cover-page excerpt */
.detail td { padding: 0 14px 16px; }
.detail .excerpt {
  border-left: 2px solid var(--oxblood); background: rgba(140,120,90,.06);
  padding: 12px 18px; max-width: 90ch;
}
.detail .ex-label {
  display: block; font-family: "IBM Plex Mono", monospace; font-size: 10px;
  letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}
.detail .excerpt p {
  margin: 0; font-family: "Newsreader", Georgia, serif; font-size: 15px;
  line-height: 1.6; color: var(--ink-soft);
}
.issuer-meta {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--muted);
  letter-spacing: .04em; margin-top: 3px; display: flex; gap: 10px; align-items: center;
}
.tkr { color: var(--gold); font-weight: 600; }
.form { border: 1px solid var(--rule-2); border-radius: 2px; padding: 0 5px; }
.cn { color: var(--oxblood); font-weight: 600; }

/* event "stamp" */
.stamp {
  display: inline-block; font-family: "IBM Plex Mono", monospace; font-size: 10.5px;
  font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 9px; border: 1px solid currentColor; border-radius: 2px;
  color: var(--c, var(--ink)); background: color-mix(in srgb, var(--c, #888) 9%, transparent);
  white-space: nowrap;
}

/* size column with magnitude bar */
.size { text-align: right; min-width: 150px; }
.size .amt { font-family: "IBM Plex Mono", monospace; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.size .amt.nil { color: var(--muted); font-weight: 400; }
.size .sub { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.bar { height: 3px; margin-top: 6px; margin-left: auto; background: var(--rule-2); border-radius: 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--oxblood), var(--oxblood-2)); border-radius: 2px;
  transform-origin: right; animation: grow .7s cubic-bezier(.2,.8,.2,1) both; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.through { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--ink-soft); max-width: 280px; line-height: 1.45; }
.through .none { color: var(--muted); }

.c-link { text-align: right; white-space: nowrap; }
.c-link a {
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; letter-spacing: .08em;
  color: var(--oxblood); text-decoration: none; border-bottom: 1px solid transparent;
}
.c-link a:hover { border-bottom-color: var(--oxblood); }

.empty {
  font-family: "IBM Plex Mono", monospace; color: var(--muted); font-size: 13px;
  padding: 40px 14px; border-bottom: 1px solid var(--rule);
}

/* ---------- footer ---------- */
.foot {
  max-width: 1320px; margin: 0 auto; padding: 22px var(--pad) 60px;
  display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between;
  border-top: 1px solid var(--rule);
  font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: .04em; color: var(--muted);
}
.foot strong { color: var(--ink-soft); font-weight: 600; }

@media (max-width: 820px) {
  .ledger thead { display: none; }
  .ledger tbody tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 0; }
  .ledger td { padding: 2px 0; }
  .ledger .size { text-align: left; }
  .bar { margin-left: 0; }
  .ledger tbody tr.detail { display: block; }
  .ledger tbody tr.detail td { display: block; padding: 0 0 14px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
