/* =====================================================================
   Performance page styles (performance.html only). Load after css/site.css.
   ===================================================================== */

/* Introduction under the H1, with the table of contents to its right */
.intro-layout {
  display: grid;
  grid-template-columns: 1fr 320px; /* wide enough that no On This Page link wraps */
  gap: 48px;
  align-items: start;
  margin-top: 24px;
}

.page-intro {
  font-size: var(--fs-md);
  line-height: var(--lh-body);
}

.page-intro p {
  margin: 0 0 1em;
}

.page-intro strong {
  font-weight: 600;
}

/* Table of contents */
.toc {
  font-size: var(--fs-base);
}

.toc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--mist);
  list-style: none;
  cursor: default;
}

.toc summary::-webkit-details-marker {
  display: none;
}

.toc-title {
  font-size: var(--fs-md);
}

.toc-chev {
  display: none;
  width: 16px;
  height: 16px;
  color: var(--pewter);
  transition: transform 0.15s ease;
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc li {
  border-bottom: 1px solid var(--hairline);
}

.toc a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  transition: background-color 0.12s ease, color 0.12s ease;
  color: var(--pewter);
  text-decoration: none;
}

.toc a:hover,
.toc a:focus-visible {
  color: var(--burgundy);
  background: var(--alabaster);
}

@media (max-width: 960px) {
  .intro-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  /* accordion on smaller screens */
  .toc summary {
    padding: 12px 0;
    border-top: 2px solid var(--mist);
    border-bottom: 1px solid var(--hairline);
    cursor: pointer;
  }

  .toc-chev {
    display: block;
  }

  .toc-details[open] .toc-chev {
    transform: rotate(180deg);
  }

  .toc summary:hover .toc-title,
  .toc summary:hover .toc-chev {
    color: var(--burgundy);
  }
}

/* =====================================================================
   Track record tables (data from the database, js/performance.js)
   ===================================================================== */
.perf-section { margin-top: 48px; }

.perf-meta {
  margin: 12px 0 0;
  font-size: var(--fs-sm);
  color: var(--pewter);
}

.perf-table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.perf-investments { min-width: 900px; }

.perf-table th,
.perf-table td {
  padding: 10px 12px 10px 0;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--hairline);
}

.perf-table .num { text-align: right; white-space: nowrap; }
.perf-table th:last-child,
.perf-table td:last-child { padding-right: 0; }

.perf-table thead th {
  font-family: inherit;
  font-size: var(--fs-xs, 12px);
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--pewter);
  border-bottom: 1px solid var(--mist);
  white-space: nowrap;
}

.perf-table thead th button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
}

.perf-table thead th.num button { flex-direction: row-reverse; }
.perf-table thead th button:hover,
.perf-table thead th[aria-sort] button { color: var(--text); }

.perf-table .sort-icon {
  width: 12px;
  height: 12px;
  color: var(--hairline);
  transition: transform 0.15s ease;
}

.perf-table thead th button:hover .sort-icon { color: var(--mist); }
.perf-table thead th[aria-sort] .sort-icon { color: var(--burgundy); }
.perf-table thead th[aria-sort="descending"] .sort-icon { transform: rotate(180deg); }

.perf-table tbody tr:hover { background: var(--alabaster); }

.perf-investments td.t-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.perf-table .empty { color: var(--pewter); text-align: center; padding: 24px 0; }

.perf-table .link-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--navy);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.perf-table .link-btn:hover { color: var(--burgundy); }

/* Filters above the investment table */
.perf-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin-top: 16px;
}

.perf-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}

.perf-filters select,
.perf-filters input {
  min-width: 200px;
  padding: 8px 10px;
  border: 1px solid var(--hairline);
  background: var(--white);
  font: inherit;
  font-weight: 400;
  font-size: var(--fs-base);
  color: var(--text);
}

.perf-filters .f-search input { min-width: 260px; }
.perf-filters .perf-meta { margin: 0 0 9px auto; }

.perf-more {
  margin-top: 16px;
  font-size: var(--fs-base);
  padding: 9px 18px;
  border: 1px solid var(--hairline);
  background: var(--white);
  color: var(--navy);
  font-weight: 600;
  cursor: pointer;
}

.perf-more:hover { border-color: var(--mist); background: var(--alabaster); }
.perf-more[hidden] { display: none; }

@media (max-width: 640px) {
  .perf-filters label,
  .perf-filters select,
  .perf-filters input,
  .perf-filters .f-search input { width: 100%; min-width: 0; }
  .perf-filters .perf-meta { margin: 0; }
}

/* Select Sponsors comparison and star marker */
.compare-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
  margin-top: 4px;
}

.compare-table th[scope="row"] {
  font-weight: 400;
  color: var(--text);
}

.compare-table td:nth-child(2) { font-weight: 600; }

.select-head {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.select-explainer {
  margin-top: 12px;
  font-size: var(--fs-base);
  line-height: var(--lh-body);
}

.select-explainer-title {
  margin: 0 0 8px;
  font-size: var(--fs-md);
}

.select-explainer p { margin: 0 0 1em; }

.select-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--burgundy);
}

.select-mark {
  display: inline-flex;
  margin-left: 6px;
  vertical-align: -1px;
}

.select-key {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  white-space: nowrap;
}

@media (max-width: 960px) {
  .compare-layout { grid-template-columns: 1fr; gap: 16px; }
}

/* Filter dropdowns: custom chevron inset 10px from the right, matching the 10px text inset on the left */
.perf-filters select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555E6E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
  cursor: pointer;
}

/* "Current 1031 Marketplace" quote cards (perfstats.mjs) */
.market-history { margin: 48px 0; }
.market-history .mh-head { margin-bottom: 20px; }
.market-history .mh-sub { margin: 12px 0 0; color: var(--pewter); }
.market-history .mh-since { display: inline-block; font-size: var(--fs-sm); color: var(--mist); }
.mh-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border: 1px solid rgba(22, 43, 69, 0.14);
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}
.mh-stat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  grid-template-areas: "label label" "quote chart" "avg avg";
  column-gap: 16px;
  padding: 16px 20px;
  border-right: 1px solid rgba(22, 43, 69, 0.1);
  border-bottom: 1px solid rgba(22, 43, 69, 0.1);
  font-family: var(--font-body);
}
.mh-stat:nth-child(3n) { border-right: 0; }
.mh-stat:nth-last-child(-n + 3) { border-bottom: 0; }
.mh-stat dt {
  grid-area: label;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mist);
}
.mh-stat dd { margin: 0; }
.mh-stat .mh-quote { grid-area: quote; display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.mh-stat .mh-current {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.mh-delta {
  align-self: flex-start;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mh-delta.is-up { color: #162B45; background: #E8EDF3; }
.mh-delta.is-down { color: #162B45; background: #E8EDF3; }
.mh-delta.is-flat { color: #555E6E; background: #EEF0F3; }
.mh-stat .mh-chart { grid-area: chart; align-self: end; }
.mh-spark { display: block; width: 120px; height: 32px; overflow: visible; }
.mh-spark polyline { fill: none; stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.mh-spark .mh-spark-fill { stroke: none; opacity: 0.12; }
.mh-spark.is-up polyline, .mh-spark.is-down polyline { stroke: #162B45; }
.mh-spark.is-up .mh-spark-fill, .mh-spark.is-down .mh-spark-fill { fill: #162B45; }
.mh-spark.is-flat polyline { stroke: #848E9F; }
.mh-spark.is-flat .mh-spark-fill { fill: #848E9F; }
.mh-spark.is-empty line { stroke: #C4CAD4; stroke-width: 1.5; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.mh-stat .mh-avg {
  grid-area: avg;
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(22, 43, 69, 0.15);
  font-size: var(--fs-sm);
  color: var(--mist);
}
.mh-stat .mh-avg strong { color: var(--navy); font-weight: 600; font-variant-numeric: tabular-nums; }
.mh-history { margin-top: 16px; }
.mh-history summary { cursor: pointer; color: var(--burgundy); font-weight: 600; }
.mh-table { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.mh-table th, .mh-table td { padding: 8px 10px; border-bottom: 1px solid rgba(22, 43, 69, 0.1); text-align: right; white-space: nowrap; }
.mh-table th:first-child { text-align: left; }
.mh-table thead th { color: var(--mist); font-weight: 600; }
.mh-table .mh-bf { color: var(--burgundy); font-weight: 600; }
.market-history .mh-note { margin-top: 12px; font-size: var(--fs-xs); color: var(--mist); }
.market-history .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 960px) {
  .mh-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mh-stat:nth-child(3n) { border-right: 1px solid rgba(22, 43, 69, 0.1); }
  .mh-stat:nth-child(2n) { border-right: 0; }
  .mh-stat:nth-last-child(-n + 3) { border-bottom: 1px solid rgba(22, 43, 69, 0.1); }
  .mh-stat:nth-last-child(-n + 2) { border-bottom: 0; }
}
@media (max-width: 560px) {
  .mh-stats { grid-template-columns: minmax(0, 1fr); }
  .mh-stat, .mh-stat:nth-child(3n) { border-right: 0; border-bottom: 1px solid rgba(22, 43, 69, 0.1); }
  .mh-stat:nth-last-child(-n + 2) { border-bottom: 1px solid rgba(22, 43, 69, 0.1); }
  .mh-stat:last-child { border-bottom: 0; }
}

/* Section explanations (perfexplain.mjs) */
.perf-explain { max-width: none; margin: 12px 0 20px; }
.perf-explain p { max-width: none; margin: 0 0 10px; color: var(--pewter); line-height: 1.65; }
.perf-explain p:last-child { margin-bottom: 0; }
.perf-explain strong { color: var(--navy); }
.market-history .perf-explain { margin-top: 0; }


/* Current 1031 Marketplace (Nov 29): today's figures only; no change, trend line or historical average */
.mh-stats .mh-delta,
.mh-stats .mh-chart,
.mh-stats .mh-avg {
  display: none;
}


/* Intro text wraps around the "On This Page" box */
.intro-layout {
  display: flow-root;
}

.intro-layout > .toc {
  float: right;
  width: 320px;
  margin: 0 0 16px 40px;
}

@media (max-width: 960px) {
  .intro-layout > .toc {
    float: none;
    width: auto;
    margin: 0 0 24px;
  }
}

/* Performance by Investment: Investment, Sponsor, Sold, Annual Return, Equity Multiple
   (Property Type, Location, Hold and IRR hidden; the sponsor and property type filters stay) */
#perf-investments th:nth-child(3),
#perf-investments td:nth-child(3),
#perf-investments th:nth-child(4),
#perf-investments td:nth-child(4),
#perf-investments th:nth-child(6),
#perf-investments td:nth-child(6),
#perf-investments th:nth-child(9),
#perf-investments td:nth-child(9) {
  display: none;
}

#perf-investments {
  min-width: 0;
  width: 100%;
}
