:root {
  --ink: #14171a;
  --muted: #5f6873;
  --line: #d9dee5;
  --panel: #f7f8f8;
  --accent: #0f766e;
  --accent-dark: #0b4f4a;
  --warn: #73510a;
  --warn-bg: #fff8e1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
}

header {
  padding: 28px clamp(20px, 5vw, 44px) 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfbfb 0%, #fff 100%);
}

main {
  padding: 22px clamp(20px, 5vw, 44px) 34px;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0;
  font-size: 20px;
}

h3 {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lede {
  max-width: 880px;
  margin: 0;
  color: #30363d;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 10px;
  max-width: 1180px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.toolbar label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

select,
input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

.data-policy {
  max-width: 1180px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #f1d78a;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 13px;
}

.model-list {
  display: grid;
  gap: 22px;
  max-width: 1180px;
}

.model-section {
  display: grid;
  gap: 12px;
}

.model-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.model-heading h2 {
  margin: 0 0 6px;
}

.model-heading p {
  max-width: 74ch;
  margin: 0;
  font-size: 13px;
}

.model-meta {
  display: grid;
  justify-items: end;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 8px;
  border: 1px solid #d1e0e0;
  border-radius: 999px;
  background: #f0f4f4;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.slice-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.slice-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(20, 23, 26, 0.05);
}

.slice-box {
  min-width: 0;
}

.slice-box summary {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  cursor: pointer;
  list-style: none;
  background: #fff;
}

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

.slice-box summary::before {
  content: "";
  display: none;
}

.slice-box[open] summary::before {
  content: "";
}

.slice-summary {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.slice-summary strong {
  font-size: 15px;
}

.slice-summary span,
.slice-count,
.analysis-item span {
  color: var(--muted);
  font-size: 12px;
}

.slice-count {
  white-space: nowrap;
}

.slice-count::after {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  border: 1px solid #bdd0d0;
  border-radius: 50%;
  color: var(--accent);
  font-weight: 850;
}

.slice-box[open] .slice-count::after {
  content: "-";
}

.slice-map {
  display: grid;
  gap: 3px;
  width: 118px;
  padding: 8px;
  border: 1px solid #dce3e4;
  border-radius: 8px;
  background: #f8fbfb;
}

.map-row {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
}

.map-cell {
  aspect-ratio: 1;
  border: 1px solid #b9c5c9;
  border-radius: 2px;
  background: transparent;
}

.map-cell.edge {
  border-color: #92a0a5;
}

.map-cell.hot {
  border-color: #0f766e;
  background: #0f766e;
  box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.12), 0 0 10px rgba(15, 118, 110, 0.24);
}

.embedding-row {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 14px;
  border: 1px solid #b9c5c9;
  border-radius: 4px;
  color: #6b747c;
  background: transparent;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.embedding-row.hot {
  border-color: #0f766e;
  color: #063f3b;
  background: #8fe0d8;
}

.map-caption {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: #637178;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.slice-body {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.analysis-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 2px 14px 14px;
  list-style: none;
}

.analysis-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.analysis-item div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.open-link,
.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.open-link:hover,
.back-link:hover {
  background: var(--accent-dark);
}

.viewer-shell {
  display: block;
  min-height: calc(100vh - 100px);
}

.plot-frame {
  width: 100%;
  height: calc(100vh - 102px);
  border: 0;
}

.metric-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.metric-list li {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
}

.metric-list strong {
  display: block;
  margin-bottom: 4px;
}

.empty {
  max-width: 760px;
  padding: 16px;
  border: 1px solid #f1d78a;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn);
}

.site-footer {
  padding: 18px clamp(20px, 5vw, 44px) 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.footer-inner {
  display: grid;
  gap: 6px;
  max-width: 1080px;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .toolbar,
  .slice-list {
    grid-template-columns: 1fr;
  }

  .model-heading,
  .analysis-item,
  .slice-box summary {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .model-meta {
    justify-items: start;
  }

  .plot-frame {
    height: calc(100vh - 102px);
  }

}
