/* A document-style page: warm monochrome, hairlines, an editorial serif for the headings, colour only
   where it means something. The charts read the same variables (charts.js). */

@font-face {
  font-family: "Geist Sans";
  src: url("fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/InstrumentSerif-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/InstrumentSerif-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light;
  --canvas: #fbfbfa;
  --surface: #ffffff;
  --bone: #f7f6f3;
  --ink: #111111;
  --ink-2: #2f3437;
  --muted: #787774;
  --line: #eaeaea;
  --grid: #f1f0ed; /* a chart's gridlines, a step quieter than a border */
  --axis: #dcdbd7;
  --series: #111111; /* the strategy */
  --benchmark: #8c8b87; /* SPY, the context */
  --up: #111111; /* a rising candle: hollow */
  --down: #111111; /* a falling candle: filled */
  --pos: #346538;
  --neg: #9f2f2d;
  --red-bg: #fdebec;
  --red-ink: #9f2f2d;
  --blue-bg: #e1f3fe;
  --blue-ink: #1f6c9f;
  --green-bg: #edf3ec;
  --green-ink: #346538;
  --yellow-bg: #fbf3db;
  --yellow-ink: #956400;
  --sans: "Geist Sans", "SF Pro Display", "Helvetica Neue", "Switzer", sans-serif;
  --serif: "Instrument Serif", "Newsreader", "Lyon Text", "Playfair Display", serif;
  --mono: "Geist Mono", "SF Mono", "JetBrains Mono", monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink-2);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p,
figure {
  margin: 0;
}

/* Two warm light spots behind everything, drifting slowly; nothing scrolls with them. */
.ambient {
  position: fixed;
  inset: -10%;
  z-index: -1;
  background:
    radial-gradient(48vw 44vh at 82% 6%, rgba(214, 176, 120, 0.11), transparent 70%),
    radial-gradient(40vw 40vh at 4% 38%, rgba(196, 170, 140, 0.07), transparent 70%);
  pointer-events: none;
  animation: drift 40s ease-in-out infinite alternate;
}

@keyframes drift {
  to {
    transform: translate3d(-3%, 2%, 0);
  }
}

/* ------------------------------------------------------------ top bar and hero */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 251, 250, 0.82);
  backdrop-filter: blur(10px);
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.brand {
  color: var(--ink);
  font: 500 14px var(--mono);
  text-decoration: none;
}

.links {
  display: flex;
  gap: 28px;
  font-size: 14px;
}

.links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 200ms ease;
}

.links a:hover {
  color: var(--ink);
}

.hero {
  position: relative;
  padding-top: 112px;
  padding-bottom: 32px;
}

/* A faint ruled grid that fades out from the top right corner. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 90% at 100% 0%, #000 0%, transparent 70%);
  opacity: 0.7;
}

.eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font: 500 12px var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.eyebrow > span:not(.tag)::before {
  content: "\2014";
  margin-right: 12px;
}

.hero .eyebrow > span:not(.tag)::before {
  content: none;
}

h1,
h2 {
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

h1 {
  max-width: 17ch;
  margin-top: 28px;
  font-size: clamp(42px, 7vw, 76px);
}

h2 {
  margin-top: 16px;
  font-size: clamp(32px, 4.4vw, 44px);
}

h3 {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.lede {
  max-width: 58ch;
  margin-top: 28px;
  color: var(--muted);
  font-size: 18px;
}

/* ------------------------------------------------------------ sections */

section {
  padding-top: 128px;
}

.section-head {
  margin-bottom: 40px;
}

.note {
  max-width: 70ch;
  margin-top: 14px;
  color: var(--muted);
}

.notice {
  margin-top: 32px;
  padding: 16px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

/* A status: its tag, then what it says. */
.status {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 16px;
  padding: 20px 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.tag {
  flex: none;
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  background: var(--bone);
  color: var(--muted);
  font: 500 11px/1.5 var(--sans);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tag:empty {
  display: none;
}

.tag.blue {
  background: var(--blue-bg);
  color: var(--blue-ink);
}

.tag.green {
  background: var(--green-bg);
  color: var(--green-ink);
}

.tag.yellow {
  background: var(--yellow-bg);
  color: var(--yellow-ink);
}

.tag.red {
  background: var(--red-bg);
  color: var(--red-ink);
}

/* ------------------------------------------------------------ figures in ruled cells */

.cells {
  display: grid;
  gap: 1px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line); /* shows through the gaps as the rules */
}

.cells.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cells.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cells.bento {
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
}

.tile {
  display: flex;
  flex-direction: column;
  padding: 24px 28px;
  background: var(--surface);
}

.tile.lead {
  grid-row: span 2;
  justify-content: space-between;
  padding: 32px;
}

.tile .label {
  color: var(--muted);
  font-size: 13px;
}

.tile .value {
  margin-top: 6px;
  color: var(--ink);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.tile.lead .value {
  margin-top: 40px;
  font-size: clamp(56px, 8vw, 88px);
  letter-spacing: -0.05em;
  line-height: 1;
}

.tile .value.small {
  font-size: 20px;
  letter-spacing: -0.02em;
  line-height: 1.5;
}

.tile .sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.up,
.tile .value.up {
  color: var(--pos);
}

.down,
.tile .value.down {
  color: var(--neg);
}

/* A change's direction as a small triangle before its signed figure. */
.delta.up::before,
.delta.down::before {
  content: "";
  display: inline-block;
  margin-right: 5px;
  border: 4px solid transparent;
}

.delta.up::before {
  border-top-width: 0;
  border-bottom: 6px solid currentColor;
  vertical-align: 1px;
}

.delta.down::before {
  border-top: 6px solid currentColor;
  border-bottom-width: 0;
  vertical-align: 1px;
}

/* ------------------------------------------------------------ cards and charts */

.card {
  min-width: 0;
  margin-bottom: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  transition: box-shadow 200ms ease;
}

.card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card figcaption,
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.chart {
  position: relative;
  height: 220px;
}

.chart.tall {
  height: 360px;
}

.legend {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 13px;
}

.legend span,
.tooltip .row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.key {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 2px;
}

.tooltip {
  position: absolute;
  z-index: 5;
  top: 4px;
  min-width: 120px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  pointer-events: none;
  white-space: nowrap;
}

.tooltip .when {
  margin-bottom: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.tooltip b {
  color: var(--ink);
  font-weight: 500;
}

.tooltip .name {
  color: var(--muted);
}

.pair {
  display: grid;
  gap: 16px;
}

.pair > figure.card {
  display: flex;
  flex-direction: column;
}

.pair > figure.card .chart {
  flex: 1;
  height: auto;
  min-height: 220px;
}

.pair.wide-left {
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
}

.pair.wide-right {
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
}

.scroll {
  overflow: auto;
}

/* ------------------------------------------------------------ tables */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.plain th,
.plain td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.plain th:first-child,
.plain td:first-child {
  padding-left: 0;
}

.plain th:last-child,
.plain td:last-child {
  padding-right: 0;
}

.plain tbody tr:last-child td {
  border-bottom: 0;
}

.plain th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.plain thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
}

.plain td {
  color: var(--ink);
}

.plain .text {
  text-align: left;
}

.plain td.text {
  color: var(--ink-2);
}

.plain td.company {
  overflow: hidden;
  max-width: 340px;
  color: var(--muted);
  text-overflow: ellipsis;
}

.plain td.ticker {
  color: var(--ink);
  font: 500 13px var(--mono);
}

.plain tr.sold td {
  color: var(--muted);
}

.holdings-scroll {
  max-height: 560px;
}

/* The weight as a thin meter beside its figure. */
.meter {
  display: inline-block;
  width: 72px;
  height: 3px;
  margin-right: 12px;
  background: var(--bone);
  vertical-align: middle;
}

.meter i {
  display: block;
  height: 100%;
  background: var(--ink);
}

.heat {
  border-collapse: separate;
  border-spacing: 2px;
  font-size: 12px;
}

.heat th {
  padding: 4px 2px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
}

.heat td {
  min-width: 34px;
  padding: 7px 2px;
  border-radius: 4px;
  color: var(--ink);
  text-align: center;
}

.heat td.total {
  font-weight: 500;
}

.heat td.gap {
  min-width: 6px;
  padding: 0;
}

/* What the tints of the heat table stand for: five flat steps, no gradient. */
.scale {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 12px;
}

.scale i {
  width: 28px;
  height: 10px;
  border-radius: 2px;
}

.facts {
  display: grid;
  gap: 4px;
  margin: 0 0 24px;
  padding: 16px 20px;
  border-radius: 8px;
  background: var(--bone);
  color: var(--muted);
  font: 12px/1.6 var(--mono);
  list-style: none;
  overflow-wrap: anywhere; /* a run's name is one long word */
}

/* ------------------------------------------------------------ controls */

button {
  font: inherit;
  cursor: pointer;
}

.primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--ink);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  transition: background 200ms ease, transform 200ms ease;
}

.primary:hover {
  background: #333333;
}

.primary:active,
.segmented button:active {
  transform: scale(0.98);
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.segmented button {
  padding: 5px 14px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  transition: background 200ms ease, color 200ms ease, transform 200ms ease;
}

.segmented button[aria-pressed="true"] {
  background: var(--ink);
  color: #ffffff;
}

.stamp {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font: 12px var(--mono);
}

/* ------------------------------------------------------------ the candles, a card a holding */

.klines {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.kline {
  margin: 0;
  padding: 20px 20px 12px;
}

.kline figcaption {
  align-items: baseline;
  flex-wrap: nowrap;
  margin-bottom: 8px;
}

.kline .who {
  overflow: hidden;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kline .who b {
  margin-right: 8px;
  color: var(--ink);
  font: 500 14px var(--mono);
}

.kline .figures {
  flex: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.kline .figures .weight {
  margin-right: 10px;
  color: var(--muted);
}

.kline .chart {
  height: 150px;
}

.stale {
  opacity: 0.55;
}

/* ------------------------------------------------------------ motion: blocks rise in as they enter */

.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 600ms var(--ease) calc(var(--index, 0) * 80ms),
    transform 600ms var(--ease) calc(var(--index, 0) * 80ms),
    box-shadow 200ms ease;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .ambient {
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ------------------------------------------------------------ footer */

footer {
  margin-top: 128px;
  padding-top: 32px;
  padding-bottom: 64px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

footer p {
  max-width: 80ch;
}

footer p + p {
  margin-top: 8px;
}

@media (max-width: 900px) {
  .pair.wide-left,
  .pair.wide-right {
    grid-template-columns: minmax(0, 1fr);
  }

  .klines {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cells.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .hero {
    padding-top: 72px;
  }

  section {
    padding-top: 88px;
  }

  .links {
    gap: 16px;
  }

  .cells.three,
  .klines {
    grid-template-columns: minmax(0, 1fr);
  }

  .cells.bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tile.lead {
    grid-column: span 2;
    grid-row: auto;
  }

  .card,
  .tile {
    padding: 20px;
  }

  .status {
    flex-direction: column;
    gap: 10px;
    padding: 20px;
  }

  .chart.tall {
    height: 280px;
  }
}
