/* SAEarth concept explorer. Colors follow the paper roles (src/saearth/paper_style.py): blue is the main color for
   concepts and activations, red a sparing accent, teal the least used; grays only for lines and backgrounds.
   All text is pure black. */
:root {
  --ink: #000000;
  --blue: #2B6CB0;
  --blue-light: #DCE7F2;
  --red: #C8423B;
  --teal: #3A9E95;
  --line: #E6E6E6;
  --band: #EFEFEF;
  --land: #E9E9E9;
  --bg: #FFFFFF;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--blue); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select { font: inherit; color: var(--ink); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 18px; margin-top: 32px; margin-bottom: 10px; }
img { display: block; max-width: 100%; }

/* Header */
.site-header { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding: 12px 24px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.brand { font-weight: 700; font-size: 18px; text-decoration: none; }
.brand span { font-weight: 400; }
.switch { display: inline-flex; border: 1px solid var(--ink); border-radius: 6px; overflow: hidden; }
.switch button { border: 0; background: var(--bg); padding: 5px 14px; cursor: pointer; }
.switch button + button { border-left: 1px solid var(--ink); }
.switch button[aria-pressed="true"] { background: var(--blue-light); font-weight: 700; }
.views { display: flex; gap: 18px; flex-wrap: wrap; }
.views a { text-decoration: none; padding: 4px 0; border-bottom: 3px solid transparent; }
.views a[aria-current="page"] { border-bottom-color: var(--blue); font-weight: 700; }
.repo { margin-left: auto; }

main { max-width: 1280px; margin: 0 auto; padding: 24px; min-height: 60vh; }
.loading { padding: 40px 0; }

/* Browse */
.browse { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start; }
.sidebar { display: flex; flex-direction: column; gap: 18px; }
.intro p { margin: 6px 0 0; font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line); padding: 12px 0; }
.stat strong { display: block; font-size: 20px; }
.stat span { font-size: 12px; line-height: 1.3; display: block; }
.filters { display: flex; flex-direction: column; gap: 12px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; }
.filters label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; }
.filters input[type="search"], .filters select { width: 100%; padding: 7px 9px; border: 1px solid var(--ink);
  border-radius: 6px; background: var(--bg); font-weight: 400; }
.filters input[type="checkbox"] { accent-color: var(--blue); width: 16px; height: 16px; }
.layout-toggle { display: inline-flex; gap: 6px; }
.layout-toggle button, .button { border: 1px solid var(--ink); background: var(--bg); border-radius: 6px; padding: 5px 12px; cursor: pointer; }
.layout-toggle button[aria-pressed="true"] { background: var(--blue-light); font-weight: 700; }
.result-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; text-decoration: none; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.card:hover { border-color: var(--blue); }
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--band); }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.card .label { font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

.list { border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 4px;
  border-bottom: 1px solid var(--line); text-decoration: none; }
.row:hover { background: var(--band); }
.row img { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; background: var(--band); }
.row .label { font-weight: 700; }
.row .numbers { text-align: right; font-size: 13px; white-space: nowrap; }
.more { margin: 22px auto 0; display: block; }
.empty { padding: 30px 0; }

/* Concept page */
.concept { max-width: 980px; margin: 0 auto; }
.crumbs { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; margin-bottom: 14px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0; margin: 18px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts div { padding: 10px 12px 10px 0; }
.facts dt { font-size: 12px; }
.facts dd { margin: 2px 0 0; font-weight: 700; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; background: var(--blue-light); font-weight: 700; font-size: 13px; }
.interpretation { font-size: 17px; line-height: 1.6; margin: 0; }
.examples { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0; }
.examples figure { margin: 0; }
.examples img { width: 100%; aspect-ratio: 1; object-fit: cover; image-rendering: auto; border-radius: 4px; background: var(--band); }
.examples figcaption { font-size: 13px; margin-top: 4px; }
.note { font-size: 13px; margin: 8px 0 0; }
.map img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; }
.legend { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-top: 8px; flex-wrap: wrap; }
.ramp { width: 200px; max-width: 50vw; }
.ramp .bar { height: 10px; border-radius: 2px; }
.ramp .ticks { display: flex; justify-content: space-between; font-size: 12px; position: relative; height: 16px; }
.ramp .ticks span { position: absolute; transform: translateX(-50%); }
.ramp .ticks span:first-child { transform: none; }
.ramp .ticks span:last-child { transform: translateX(-100%); }
.links { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
.links a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.links a:hover .name { text-decoration: underline; text-decoration-color: var(--blue); }
.links .num { font-size: 13px; white-space: nowrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
pre.code { position: relative; background: var(--band); border-radius: 6px; padding: 14px 16px; overflow-x: auto;
  font: 13px/1.55 var(--mono); margin: 0; }
.copy { position: absolute; top: 8px; right: 8px; font: 13px var(--font); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Semantic map */
.view-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.view-head p { margin: 6px 0 0; max-width: 720px; }
.theme-legend { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 10px 0 12px; }
.theme-legend button { border: 1px solid var(--line); background: var(--bg); border-radius: 14px; padding: 3px 10px; cursor: pointer; font-size: 13px; }
.theme-legend button[aria-pressed="true"] { border-color: var(--ink); font-weight: 700; }
.scatter { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; touch-action: manipulation; }
.scatter circle { cursor: pointer; stroke: #FFFFFF; stroke-width: 1; }
.scatter circle.dim { opacity: 0.12; }
.scatter circle.hit { stroke: var(--ink); stroke-width: 1.5; }
.tooltip { position: fixed; z-index: 10; pointer-events: none; background: var(--bg); border: 1px solid var(--ink);
  border-radius: 6px; padding: 6px 9px; font-size: 13px; max-width: 280px; }
.map-search { width: 260px; max-width: 100%; padding: 7px 9px; border: 1px solid var(--ink); border-radius: 6px; }

/* Theme maps */
.themes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 32px; }
.theme-card h3 { font-size: 16px; display: flex; align-items: center; }
.theme-card .meta { margin: 4px 0 8px; }
.theme-card img { width: 100%; border: 1px solid var(--line); border-radius: 4px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 18px 24px 28px; font-size: 13px; max-width: 1280px; margin: 40px auto 0; }
.site-footer p { margin: 4px 0; }

@media (max-width: 860px) {
  .site-header { padding: 10px 16px; gap: 10px 14px; }
  .repo { margin-left: 0; }
  main { padding: 16px; }
  .browse { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .examples { grid-template-columns: repeat(2, 1fr); }
  .two, .themes { grid-template-columns: minmax(0, 1fr); }
  .site-footer { padding: 16px; }
  h1 { font-size: 22px; }
}
