:root {
  color-scheme: light;
  --ink: #20211c;
  --muted: #6a675f;
  --paper: #f4f1ea;
  --panel: #fbfaf5;
  --line: #d8d1c3;
  --line-strong: #b9ad9a;
  --gain: #157a5a;
  --loss: #b33b3b;
  --accent: #245b73;
  --accent-2: #c77d2a;
  --shadow: 0 22px 60px rgba(44, 38, 26, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(90deg, rgba(32, 33, 28, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(32, 33, 28, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 44px 44px;
  color: var(--ink);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1520px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  min-height: 260px;
  padding: 38px 0 30px;
  border-bottom: 2px solid var(--ink);
}

.kicker,
.asof span,
.metrics span,
.layer-label,
th {
  margin: 0;
  color: var(--muted);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  max-width: 960px;
  margin: 8px 0 0;
  font-size: clamp(3.25rem, 8vw, 8.5rem);
  line-height: 0.86;
  letter-spacing: 0;
}

.subhead {
  max-width: 760px;
  margin: 24px 0 0;
  color: #48463f;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1.68;
}

.asof {
  min-width: 260px;
  padding: 18px 20px;
  border: 1px solid var(--ink);
  background: rgba(251, 250, 245, 0.78);
}

.asof strong {
  display: block;
  margin-top: 8px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.02rem;
  line-height: 1.45;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--ink);
}

.metrics div {
  min-height: 132px;
  padding: 24px 22px;
  border-right: 1px solid var(--line-strong);
}

.metrics div:last-child {
  border-right: 0;
}

.metrics strong {
  display: block;
  margin-top: 22px;
  font-size: clamp(1.3rem, 2vw, 2.1rem);
  line-height: 1.05;
}

.layer-tabs {
  display: flex;
  gap: 8px;
  padding: 24px 0;
  overflow-x: auto;
}

.layer-tabs button,
.view-tools select,
.view-tools input {
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: rgba(251, 250, 245, 0.92);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.layer-tabs button {
  flex: 0 0 auto;
  padding: 11px 14px;
  cursor: pointer;
}

.layer-tabs button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.focus-panel {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 22px;
  min-height: 430px;
  padding: 22px;
  border: 1px solid var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.focus-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line);
  padding-right: 22px;
}

.focus-copy h2 {
  margin: 18px 0;
  font-size: clamp(2rem, 4vw, 4.8rem);
  line-height: 0.92;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.focus-copy p:last-child {
  margin: 0;
  color: var(--muted);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

.focus-chart-wrap {
  min-width: 0;
  min-height: 380px;
}

#focusChart {
  display: block;
  width: 100%;
  height: 100%;
}

.rank-section {
  padding: 44px 0 24px;
}

.section-heading {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3.2rem);
  line-height: 1;
}

.view-tools {
  display: flex;
  gap: 10px;
}

.view-tools input,
.view-tools select {
  height: 42px;
  padding: 0 12px;
}

.table-wrap {
  overflow-x: auto;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: rgba(251, 250, 245, 0.72);
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.gain {
  color: var(--gain);
}

.loss {
  color: var(--loss);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

.stock-card {
  min-width: 0;
}

.card-button {
  display: flex;
  width: 100%;
  min-height: 300px;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  background: rgba(251, 250, 245, 0.82);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.card-button:hover,
.card-button:focus-visible {
  border-color: var(--ink);
  outline: 0;
  transform: translateY(-1px);
}

.card-head {
  display: flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
}

.card-head h3 {
  margin: 5px 0 0;
  font-size: 1.55rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.return-pill {
  flex: 0 0 auto;
  min-width: 76px;
  padding: 6px 8px;
  border: 1px solid currentColor;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.86rem;
  text-align: center;
}

.company {
  min-height: 38px;
  margin: 0;
  color: var(--muted);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  line-height: 1.35;
}

.mini-chart {
  display: block;
  width: 100%;
  height: 155px;
  margin-top: auto;
  background: #f7f4ed;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
}

.notes {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.92rem;
  line-height: 1.55;
}

.notes h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: 1.5rem;
}

.notes ul {
  margin: 0;
  padding-left: 18px;
}

.axis text {
  fill: var(--muted);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
}

.axis line,
.axis path,
.grid-line {
  stroke: var(--line);
}

@media (max-width: 900px) {
  .shell {
    width: min(100% - 22px, 1520px);
    padding-top: 18px;
  }

  .masthead,
  .focus-panel,
  .section-heading {
    grid-template-columns: 1fr;
  }

  .masthead {
    min-height: 0;
  }

  .asof {
    min-width: 0;
  }

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

  .metrics div:nth-child(2n) {
    border-right: 0;
  }

  .focus-copy {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 18px;
  }

  .focus-chart-wrap {
    min-height: 320px;
  }

  .view-tools {
    width: 100%;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 3.1rem;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .metrics div {
    min-height: 100px;
    border-right: 0;
  }

  .focus-panel {
    padding: 14px;
  }
}
