/* MIND landing page — scholarly project-page register.
   Serif body/headings (Source Serif 4), mono for kickers/links/code,
   hairline rules, one accent (periwinkle) used sparingly. The one deliberate
   exception is the "Inside the store" section, which flips to ink-on-ink so
   the chunk strip and shard heatmap carry their own color. */

:root {
  --ink: #3b1e1c;          /* TG dark brown */
  --paper: #f4f4eb;        /* ivory */
  --muted: #6e665e;
  --rule: #e4ded2;
  --accent: #4a55c7;       /* periwinkle, used sparingly */
  --ours: #ff4f2c;         /* MIND coral, matches the paper's plots */
  --warn: #9a5b2e;
  --dark: #17120f;
  --dark-2: #241d19;
  --dark-rule: #3a302a;
  --dark-muted: #a39a8e;
  --dark-text: #f2ede2;
  --maxw: 800px;
  --wide: 1000px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.6;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
.page { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.wide { max-width: var(--wide); margin: 0 auto; padding: 0 24px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code { font-family: var(--mono); font-size: 0.86em; }

/* ---------- header ---------- */
.hero {
  padding: 30px 0 18px;
  text-align: center;
  border-bottom: 1px solid var(--rule);
}
.hero-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  margin-bottom: 14px;
}
.research-home {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 16px;
  min-height: 44px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.74rem;
  white-space: nowrap;
}
.research-home:hover { color: var(--ink); text-decoration: none; }
.research-home:hover span { text-decoration: underline; text-underline-offset: 3px; }
.research-home .mark { width: 32px; height: 32px; display: block; flex: none; }
h1 {
  font-size: 2.2rem;
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.012em;
  margin: 0 auto 0.4em;
  max-width: 22em;
}
h1 .it { font-style: italic; font-weight: 500; }
.hero-heading h1 { grid-column: 2; justify-self: center; margin: 0; }
.subtitle {
  text-wrap: balance;
  font-size: 1.15rem;
  color: var(--ink);
  font-weight: 400;
  max-width: 32em;
  margin: 0 auto 0.8em;
}
.title-tail { white-space: nowrap; }
.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  list-style: none;
  font-size: 0.95rem;
  margin: 0 auto;
  padding: 0;
}
.authors a { display: block; min-height: 44px; color: var(--ink); white-space: nowrap; }
.affil { display: block; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.affil abbr { text-decoration: none; }
.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 1.25em;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.01em;
  margin-top: 0.5em;
}
.links a {
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  padding: 10px 0;
}
.links a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* ---------- sections ---------- */
section { padding: 34px 0; scroll-margin-top: 16px; border-bottom: 1px solid var(--rule); }
section:last-of-type { border-bottom: 0; }
.kick {
  font-family: var(--mono);
  font-size: 0.71rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.7em;
}
h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.01em;
  margin: 0 0 0.65em;
}
p { margin: 0 0 1.05em; }
.lead { font-size: 1.05rem; line-height: 1.6; }
b, strong { font-weight: 600; }
.tnum { font-family: var(--mono); font-size: 0.92em; font-variant-numeric: tabular-nums; }

/* ---------- figures ---------- */
figure { margin: 1.25em 0 0; }
figure + p { margin-top: 1.25em; }
figure img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: #fff;
}
figure.two-up, figure.three-up, figure.four-up {
  display: grid;
  gap: 12px;
  align-items: start;
}
figure.two-up { grid-template-columns: 1fr 1fr; }
figure.three-up { grid-template-columns: 1fr 1fr 1fr; }
figure.four-up { grid-template-columns: 1fr 1fr; }
figure.two-up figcaption, figure.three-up figcaption, figure.four-up figcaption { grid-column: 1 / -1; }
figcaption {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
  margin-top: 0.6em;
}
figcaption b { color: var(--ink); }

/* ---------- results table ---------- */
.tablewrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; margin: 0.4em 0 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
table.res {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.res th, table.res td { padding: 3px 5px; text-align: right; }
table.res th:first-child, table.res td:first-child { text-align: left; font-family: var(--serif); font-size: 0.86rem; }
table.res thead th { font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--rule); }
table.res thead tr:first-child th { color: var(--ink); border-bottom: 0; padding-bottom: 0; }
table.res thead tr:first-child th[scope="colgroup"] { position: relative; text-align: center; padding-bottom: 7px; }
table.res th[scope="colgroup"]::after { content: ""; position: absolute; bottom: 1px; left: 5px; right: 5px; border-bottom: 1px solid var(--muted); }
table.res thead tr.sub th { padding-top: 2px; }
table.res tbody tr.ref td { color: var(--muted); border-bottom: 1px solid var(--rule); }
table.res tbody tr.ours td:first-child { color: var(--ours); }
table.res tbody tr.best td { background: #f5efe6; }
table.res tbody tr.ours:first-of-type td { border-top: 1px solid var(--rule); }
table.res td b { font-weight: 600; color: var(--ink); }
table.res td i { font-style: italic; }

/* ---------- interactive map ---------- */
.map-frame {
  position: relative;
  width: 100%;
  border: 1px solid var(--rule);
  background: #e9e8df;
  aspect-ratio: 2 / 1;
  overflow: hidden;
}
#map-preview { width: 100%; height: 100%; object-fit: contain; display: block; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; background: #e9e8df; }
.map-frame.is-interactive { min-height: 300px; }
.caption {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0.7em 0 0;
}
.map-status {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  margin: 0.6em 0 0;
}
.map-status.is-ok { color: var(--accent); }
.map-status.is-warn { color: var(--warn); }

.map-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 16px 0 10px;
  font-family: var(--mono);
  font-size: 0.72rem;
}
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 2px; overflow: hidden; }
.seg button, #map-activate {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 10px 12px;
  min-height: 44px;
  cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--rule); }
.seg button[aria-pressed="true"] { color: var(--paper); background: var(--ink); }
#map-activate { color: var(--accent); padding-inline: 0; }
#map-activate:disabled { color: var(--muted); cursor: wait; }
[hidden] { display: none !important; }

/* ---------- inside the store (dark section) ---------- */
section.dark {
  background:
    radial-gradient(1200px 500px at 15% -10%, #3a2a22 0%, transparent 60%),
    radial-gradient(900px 400px at 100% 110%, #1f2a3a 0%, transparent 60%),
    var(--dark);
  color: var(--dark-text);
  border-bottom: 0;
}
section.dark .kick { color: var(--dark-muted); }
section.dark h2 { color: #fff; }
section.dark .lead { color: #e2dbcd; }
section.dark .caption, section.dark .caption.on-dark { color: var(--dark-muted); }
section.dark .tnum { color: #fff; }

.store-grid {
  display: grid;
  grid-template-columns: 1fr 1.28fr;
  gap: 18px;
  margin-top: 1.2em;
}
.explorer, .density {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--dark-rule);
  border-radius: 4px;
  padding: 14px 16px 12px;
  min-width: 0;
}
.ex-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.ex-title { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dark-muted); }
.ex-readout { font-family: var(--mono); font-size: 0.78rem; color: #fff; font-variant-numeric: tabular-nums; }
#ex-svg { width: 100%; height: auto; display: block; }
.ex-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }
.ex-ctl { display: flex; flex-direction: column; gap: 4px; font-family: var(--mono); font-size: 0.74rem; color: var(--dark-muted); }
.ex-ctl b { color: #fff; font-weight: 500; }
.ex-ctl input[type="range"] { width: 100%; accent-color: var(--ours); }
.ex-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--dark-muted);
}
.ex-stats .st { border-top: 1px solid var(--dark-rule); padding-top: 6px; }
.ex-stats .st b { display: block; color: #fff; font-weight: 500; font-size: 1.15rem; line-height: 1.2; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.ex-stats .st b.ours { color: var(--ours); }
#dn-canvas { width: 100%; height: auto; display: block; border-radius: 2px; cursor: crosshair; }
.ex-note { font-size: 0.84rem; line-height: 1.5; color: var(--dark-muted); margin: 10px 0 0; }

.strip-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 30px 0 10px; }
.strip-ctl { display: inline-flex; align-items: baseline; gap: 12px; }
.strip-play {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dark);
  background: var(--ours);
  border: 0;
  border-radius: 2px;
  padding: 10px 12px;
  min-height: 44px;
  cursor: pointer;
}
.strip-play:hover { filter: brightness(1.08); }
.strip {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6px;
}
.chip {
  font: inherit;
  text-align: left;
  min-width: 0;
  position: relative;
  border: 1px solid var(--dark-rule);
  border-radius: 3px;
  padding: 3px 3px 5px;
  background: var(--dark-2);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.15s;
}
.chip.in { opacity: 1; transform: none; }
.chip:hover, .chip.sel { border-color: var(--ours); }
.chip.sel { box-shadow: 0 0 0 1px var(--ours); }
.chip img { width: 100%; display: block; aspect-ratio: 2 / 1; object-fit: cover; object-position: 50% 42%; border-radius: 2px; background: #0e0b09; }
.chip .n { position: absolute; top: 5px; left: 6px; font-family: var(--mono); font-size: 0.62rem; color: #fff; text-shadow: 0 0 3px #000; }
.chip .bar { height: 3px; margin-top: 4px; background: var(--dark-rule); border-radius: 1px; overflow: hidden; }
.chip .bar i { display: block; height: 100%; background: var(--ours); }
.chip.bound::before {
  content: "";
  position: absolute;
  left: -4px; top: 6px; bottom: 6px;
  width: 1px;
  background: #fff;
  opacity: 0.55;
}
.strip-focus {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  align-items: center;
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--dark-rule);
  border-radius: 4px;
  padding: 12px;
}
.strip-focus img { width: 100%; display: block; border-radius: 2px; background: #0e0b09; image-rendering: auto; }
.strip-meta { font-family: var(--mono); font-size: 0.78rem; color: var(--dark-muted); line-height: 1.6; }
.strip-meta b { color: #fff; font-weight: 500; }
.strip-meta .big { display: block; font-family: var(--serif); font-size: 1.5rem; color: #fff; letter-spacing: -0.01em; line-height: 1.15; margin-bottom: 6px; }
.strip-meta .ours { color: var(--ours); }
.scale-chart { width: 100%; height: auto; display: block; margin-top: 18px; }

/* ---------- resources list ---------- */
.reslist { list-style: none; margin: 0.5em 0 0; padding: 0; border-top: 1px solid var(--rule); }
.reslist li {
  display: grid;
  grid-template-columns: 7em 1fr;
  gap: 1.4em;
  padding: 0.95em 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
.reslist .rk {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.reslist .rt { font-weight: 600; font-size: 1.05rem; }
.reslist .rd { display: block; color: var(--muted); font-size: 0.94rem; margin-top: 0.2em; }

/* ---------- footer ---------- */
footer { padding: 26px 0 36px; color: var(--muted); font-size: 0.9rem; }
.foot { display: flex; align-items: flex-start; gap: 14px; }
.foot svg { width: 30px; height: 30px; flex: none; margin-top: 2px; color: var(--ink); }
.foot .nm { color: var(--ink); font-weight: 600; }
.foot-meta { line-height: 1.55; }

/* ---------- leaflet chrome toned to the page ---------- */
.leaflet-container { font-family: var(--serif); }
.leaflet-bar a { color: var(--ink); }
.leaflet-control-attribution { font-size: 10px; }

/* ---------- navigation ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.skip-link { position: absolute; top: 8px; left: 16px; padding: 10px; background: var(--paper); z-index: 1000; transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.section-nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 0 24px; font-size: 0.88rem; margin-top: 12px; }
.section-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }
.table-hint { display: none; font-size: 0.85rem; color: var(--muted); }
.store-content { margin-top: 20px; }

/* ---------- responsive ---------- */
@media (max-width: 840px) {
  .hero-heading { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .hero-heading h1 { grid-column: 1; }
}
@media (max-width: 900px) {
  .store-grid { grid-template-columns: minmax(0, 1fr); }
  .strip { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .strip-focus { grid-template-columns: minmax(0, 1fr); }
  .table-hint { display: block; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .page, .wide { padding-inline: 20px; }
  h1 { font-size: 1.9rem; }
  h2 { font-size: 1.35rem; line-height: 1.25; }
  .hero { padding: 20px 0 12px; }
  .hero-heading { padding-inline: 20px; }
  .subtitle { font-size: 1.05rem; line-height: 1.4; }
  .links { gap: 0 16px; }
  .section-nav { gap: 0 20px; margin-top: 6px; }
  section { padding: 26px 0; }
  .lead { font-size: 1rem; }
  .reslist li { grid-template-columns: minmax(0, 1fr); gap: 0.2em; padding-block: 12px; }
  figure.two-up, figure.three-up, figure.four-up { grid-template-columns: minmax(0, 1fr); }
  .map-controls { gap: 0; }
  .seg { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seg button { padding-inline: 8px; }
  .seg button:nth-child(3) { border-left: 0; }
  .seg button:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .map-frame.is-interactive { min-height: 260px; }
  .strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ex-controls { grid-template-columns: minmax(0, 1fr); }
  .ex-stats { grid-template-columns: minmax(0, 1fr); }
  .ex-stats .st b { font-size: 1rem; }
  .ex-readout, .tnum { overflow-wrap: anywhere; }
  .explorer, .density { padding: 12px; }
  .strip-meta .big { font-size: 1.15rem; }
  table.res th:first-child, table.res td:first-child { position: sticky; left: 0; z-index: 1; background: var(--paper); box-shadow: 1px 0 var(--rule); }
  table.res tbody tr.best td:first-child { background: #f5efe6; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chip { transition: none; opacity: 1; transform: none; }
}
