/* WhaleCreep shell: the one stylesheet both halves of the site share.

   The static pages link this file (export.py writes it under a content hash)
   and the React board imports it, so the header, the tokens and the type are the same object
   on / and on /app/ rather than two things kept in step by hand.

   Theme is `data-theme` on <html>, stored as localStorage "whalecreep.mode",
   which both halves read: switch it on a fund page and the board follows. */

:root {
  color-scheme: light;
  --plane: #ffffff;            /* page */
  --surface: #ffffff;          /* cards, bars, menus */
  --raised: #f8f9fd;           /* table heads, wells */
  --hover: #f0f3fa;
  --ink-primary: #131722;
  --ink-secondary: #434651;
  --ink-muted: #787b86;
  --grid: #ebedf2;             /* hairlines inside a surface */
  --axis: #d1d4dc;
  --border: #e0e3eb;
  --accent: #2962ff;
  --accent-hover: #1e53e5;
  --accent-ink: #ffffff;
  --link: #2962ff;
  --up: #089981;
  --down: #f23645;
  --control-bg: #ffffff;
  --control-active: #131722;
  --control-active-ink: #ffffff;
  --shadow: 0 2px 4px rgba(19, 23, 34, 0.06), 0 8px 24px rgba(19, 23, 34, 0.08);
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --plane: #131722;
  --surface: #1e222d;
  --raised: #1a1e29;
  --hover: #2a2e39;
  --ink-primary: #d1d4dc;
  --ink-secondary: #b2b5be;
  --ink-muted: #787b86;
  --grid: #2a2e39;
  --axis: #434651;
  --border: #2a2e39;
  --accent: #2962ff;
  --accent-hover: #4a7bff;
  --accent-ink: #ffffff;
  --link: #5b9cf6;
  --up: #22ab94;
  --down: #f7525f;
  --control-bg: #1e222d;
  --control-active: #d1d4dc;
  --control-active-ink: #131722;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink-primary);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

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

.muted { color: var(--ink-muted); }
.small { font-size: 13px; }
.spacer { flex: 1 1 auto; }

/* ----------------------------------------------------------------- header */

.wc-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--plane);
  border-bottom: 1px solid var(--border);
}

.wc-header-in {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 20px;
  max-width: 1720px;
  margin: 0 auto;
}

.wc-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-right: 14px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
  white-space: nowrap;
}
.wc-brand:hover { text-decoration: none; }
.wc-mark { width: 28px; height: 28px; flex: 0 0 auto; color: var(--ink-primary); }

.wc-nav { display: flex; align-items: center; gap: 2px; min-width: 0; }

.wc-nav a {
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--ink-primary);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}
.wc-nav a:hover { background: var(--hover); text-decoration: none; }
.wc-nav a[aria-current="page"] { background: var(--hover); font-weight: 600; }
.wc-nav .wc-nav-sep { width: 1px; height: 20px; background: var(--border); margin: 0 8px; }

.wc-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  width: 240px;
  margin: 0 0 0 auto;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--hover);
  border: 1px solid transparent;
  color: var(--ink-muted);
}
.wc-search:focus-within { background: var(--surface); border-color: var(--accent); }
.wc-search svg { width: 16px; height: 16px; flex: 0 0 auto; }
.wc-search input {
  appearance: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink-primary);
  font: inherit;
  font-size: 14px;
  width: 100%;
  min-width: 0;
}
.wc-search input::placeholder { color: var(--ink-muted); }

.wc-icon-btn {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-primary);
  cursor: pointer;
}
.wc-icon-btn:hover { background: var(--hover); }
.wc-icon-btn svg { width: 18px; height: 18px; }
.wc-icon-btn .i-sun { display: none; }
:root[data-theme="dark"] .wc-icon-btn .i-sun { display: block; }
:root[data-theme="dark"] .wc-icon-btn .i-moon { display: none; }

.wc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-primary);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.wc-btn:hover { background: var(--hover); text-decoration: none; }
.wc-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.wc-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.wc-btn.large { height: 44px; padding: 0 22px; font-size: 15px; }

:is(.wc-nav a, .wc-icon-btn, .wc-btn):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 1080px) {
  .wc-header-in { height: auto; flex-wrap: wrap; padding: 8px 12px; row-gap: 4px; }
  .wc-nav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .wc-nav a { font-size: 14px; padding: 6px 10px; }
  .wc-search { flex: 1 1 140px; width: auto; }
}

/* ---------------------------------------------------------- autocomplete */

.wc-ac-host { position: relative; }
.wc-ac {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(440px, calc(100vw - 32px));
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}
.wc-ac li {
  display: grid;
  /* A security with no ticker shows its CUSIP, which needs more than 64px. */
  grid-template-columns: minmax(64px, max-content) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-primary);
  cursor: pointer;
}
.wc-ac li[aria-selected="true"] { background: var(--hover); }
.wc-ac-issuer { color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-ac-count { color: var(--ink-secondary); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* -------------------------------------------------------------- accounts */

.wc-account { display: flex; align-items: center; min-width: 36px; }
.wc-avatar {
  appearance: none;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.wc-avatar.is-paid { box-shadow: 0 0 0 2px var(--plane), 0 0 0 4px var(--up); }
.chip.is-paid { background: var(--up); color: #fff; }

.wc-dialog {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  background: var(--surface);
  color: var(--ink-primary);
  box-shadow: var(--shadow);
}
.wc-dialog::backdrop { background: rgba(19, 23, 34, 0.55); backdrop-filter: blur(2px); }
.wc-dialog h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.015em; }
.wc-dialog p { margin: 0 0 14px; }
.wc-dialog-close { position: absolute; top: 12px; right: 12px; font-size: 14px; }
.wc-dialog-form { display: grid; gap: 12px; margin: 18px 0 14px; }
.wc-dialog-form label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-secondary); }
.wc-dialog-form input {
  height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--plane);
  color: var(--ink-primary);
  font: inherit;
  font-size: 15px;
}
.wc-dialog-form input:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.wc-google { width: 100%; margin-top: 18px; gap: 10px; }
.wc-google svg { width: 18px; height: 18px; }
.wc-dialog-or { display: flex; align-items: center; gap: 12px; margin: 14px 0 -4px; font-size: 12px; color: var(--ink-muted); }
.wc-dialog-or::before, .wc-dialog-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.wc-dialog-error { color: var(--down); font-size: 13px; margin: 0; }
.wc-dialog-error.is-info { color: var(--ink-secondary); }
.wc-dialog-alt { font-size: 13px; color: var(--ink-muted); margin: 0 0 6px; }
.wc-dialog-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.wc-link { appearance: none; border: 0; background: none; padding: 0; color: var(--link); font: inherit; cursor: pointer; }
.wc-link:hover { text-decoration: underline; }
.wc-btn:disabled { opacity: 0.6; cursor: default; }

.wc-watch { height: 32px; padding: 0 14px; font-size: 13px; }
.wc-watch[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.wc-watch-slot { margin: 2px 0 10px; min-height: 32px; }
.wc-watchlist { margin: 4px 0 16px; padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.wc-watchlist h3 { margin: 0 0 8px; font-size: 14px; }
.wc-watchlist ul { list-style: none; margin: 0 0 10px; padding: 0; max-height: 220px; overflow-y: auto; }
.wc-watchlist li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.wc-watchlist li .wc-icon-btn { width: 28px; height: 28px; font-size: 12px; color: var(--ink-muted); }
.wc-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-secondary); }
.wc-toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

/* A guest past the free funds: the detail blurs, the summary above it stays. */
.wc-walled .paywall { filter: blur(7px); pointer-events: none; user-select: none; }

/* ------------------------------------------------------------ doc pages */

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px; }

main.doc { padding: 20px 0 56px; font-size: 15px; line-height: 1.6; }
main.doc h1 { font-size: 34px; line-height: 1.15; letter-spacing: -0.025em; font-weight: 700; margin: 10px 0 10px; max-width: 26ch; }
main.doc h2 { font-size: 22px; line-height: 1.25; letter-spacing: -0.015em; font-weight: 700; margin: 40px 0 8px; }
main.doc h3 { font-size: 16px; margin: 22px 0 6px; }
main.doc p { max-width: 78ch; }
.lede { font-size: 17px; color: var(--ink-secondary); }

.crumbs { font-size: 13px; color: var(--ink-muted); margin-top: 6px; }
.crumbs a { color: var(--ink-muted); }

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 20px 0; }
.fact { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); }
.fact b { display: block; font-size: 24px; line-height: 1.2; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fact span { font-size: 13px; color: var(--ink-muted); }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 820px) { .cols { grid-template-columns: 1fr; } main.doc h1 { font-size: 28px; } }

.notice {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 14px;
  color: var(--ink-secondary);
  font-size: 13px;
  margin: 14px 0;
}

/* Plain tables: what a crawler and a no-JS reader get, and what small tables
   stay as. Tables marked data-grid are upgraded to AG Grid by /app/enhance.js. */
.tbl { overflow-x: auto; margin: 10px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tbl table { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 14px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th { background: var(--raised); color: var(--ink-muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
.tbl tr:hover td { background: var(--hover); }
.tbl td.n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }
.tbl.is-grid { border: 0; background: transparent; overflow: visible; }

.new { color: var(--up); font-weight: 600; }
.added { color: var(--up); }
.reduced, .trimmed, .exited { color: var(--down); }
.held { color: var(--ink-muted); }

/* AG Grid chrome: the toolbar above a grid, on the board and on upgraded
   static tables alike. The grid itself is themed in web/src/grid.ts. */
.wc-grid { margin-top: 10px; }
.wc-grid-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.wc-grid-filter { width: 280px; height: 34px; margin: 0; }
.wc-grid-count { font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.wc-num { font-variant-numeric: tabular-nums; }
.wc-row-click { cursor: pointer; }
.ag-cell.muted, .ag-cell .muted { color: var(--ink-muted); }
.ag-cell a { color: var(--link); }
.ag-cell .small { font-size: 12px; }

/* Homepage hero and the live strip under it */
.hero { padding: 72px 0 8px; text-align: center; }
main.doc .hero h1 { font-size: 52px; line-height: 1.04; letter-spacing: -0.035em; max-width: 18ch; margin: 0 auto 16px; }
/* The type-on headline. Every character is laid out from the start and only
   its opacity changes, so the line breaks never move while it types. */
[data-type-on] .w { display: inline-block; white-space: pre; }
[data-type-on] .c { opacity: 0; }
[data-type-on] .c.on { opacity: 1; }
[data-type-on] .c.caret { box-shadow: 3px 0 0 var(--accent); animation: wc-caret 0.9s steps(1) infinite; }
@keyframes wc-caret { 50% { box-shadow: none; } }

main.doc .hero p.small { margin: 14px auto 0; }
main.doc .hero .lede { margin: 0 auto; max-width: 62ch; }
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 26px 0 6px; }
.hero .wc-search { width: min(520px, 100%); height: 48px; margin: 26px auto 0; padding: 0 20px; }
.hero .wc-search input { font-size: 16px; }
@media (max-width: 820px) { main.doc .hero h1 { font-size: 36px; } }

.tape { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 28px 0 0; }
@media (max-width: 900px) { .tape { grid-template-columns: repeat(2, 1fr); } }
.tape:empty { display: none; }
.tape a { display: block; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; background: var(--surface); color: inherit; text-align: left; }
.tape a:hover { background: var(--hover); text-decoration: none; }
.tape-name { font-size: 12px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tape-level { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tape-chg { font-size: 13px; font-variant-numeric: tabular-nums; }
.pos { color: var(--up); }
.neg { color: var(--down); }

.wc-footer { border-top: 1px solid var(--border); padding: 24px 0 40px; font-size: 13px; color: var(--ink-muted); }
.wc-footer-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 12px; }
.wc-footer-nav a { color: var(--ink-secondary); font-weight: 500; }
.wc-footer p { margin: 4px 0; max-width: 100ch; }
